ansible / ansible.utils / 4.0.0 / test / ipv4_netmask Test if an address is a valid netmask | "added in version" 2.2.0 of ansible.utils" Authors: Priyam Sahoo (@priyamsahoo)ansible.utils.ipv4_netmask (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 valid IPv4 netmask or not
#### Simple examples - name: Check if 255.255.255.0 is a netmask ansible.builtin.set_fact: data: "{{ '255.255.255.0' is ansible.utils.ipv4_netmask }}"
# TASK [Check if 255.255.255.0 is a netmask] ******************************************* # ok: [localhost] => { # "ansible_facts": { # "data": true # }, # "changed": false # } - name: Check if 255.255.255.128 is a netmask ansible.builtin.set_fact: data: "{{ '255.255.255.128' is ansible.utils.ipv4_netmask }}"
# TASK [Check if 255.255.255.128 is a netmask] ***************************************** # ok: [localhost] => { # "ansible_facts": { # "data": true # }, # "changed": false # } - name: Check if 255.255.255.127 is not a netmask ansible.builtin.set_fact: data: "{{ '255.255.255.127' is not ansible.utils.ipv4_netmask }}"
mask: 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)