ansible / ansible.utils / 4.0.0 / test / ipv4_hostmask Test if an address is a valid hostmask | "added in version" 2.2.0 of ansible.utils" Authors: Priyam Sahoo (@priyamsahoo)ansible.utils.ipv4_hostmask (4.0.0) — test
Install with ansible-galaxy collection install ansible.utils:==4.0.0
collections: - name: ansible.utils version: 4.0.0
This plugin checks if the provided ip address is a IPv4 hostmask or not
#### Simple examples - name: Check if 0.0.0.255 is a hostmask ansible.builtin.set_fact: data: "{{ '0.0.0.255' is ansible.utils.ipv4_hostmask }}"
# TASK [Check if 0.0.0.255 is a hostmask] *********************************************** # ok: [localhost] => { # "ansible_facts": { # "data": true # }, # "changed": false # } - name: Check if 255.255.255.0 is not a hostmask ansible.builtin.set_fact: data: "{{ '255.255.255.0' is not ansible.utils.ipv4_hostmask }}"
ip: description: - A string that represents the value against which the test is going to be performed - 'For example: C(0.1.255.255) or C(255.255.255.0)' required: true type: str
data: description: - If jinja test satisfies plugin expression C(true) - If jinja test does not satisfy plugin expression C(false)