ansible / ansible.utils / 4.0.0 / test / multicast Test for a multicast IP address | "added in version" 2.2.0 of ansible.utils" Authors: Priyam Sahoo (@priyamsahoo)ansible.utils.multicast (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 value is a valid multicast IP address
- name: Check if 224.0.0.1 is a valid multicast IP address ansible.builtin.set_fact: data: "{{ '224.0.0.1' is ansible.utils.multicast }}"
# TASK [Check if 224.0.0.1 is a valid multicast IP address] ********************** # ok: [localhost] => { # "ansible_facts": { # "data": true # }, # "changed": false # } - name: Check if ff02::1 is a valid multicast IP address ansible.builtin.set_fact: data: "{{ 'ff02::1' is ansible.utils.multicast }}"
# TASK [Check if ff02::1 is a valid multicast IP address] *************************** # ok: [localhost] => { # "ansible_facts": { # "data": true # }, # "changed": false # } - name: Check if 127.0.0.1 is not a valid multicast IP address ansible.builtin.set_fact: data: "{{ '127.0.0.1' is not ansible.utils.multicast }}"
# TASK [Check if 127.0.0.1 is not a valid multicast IP address] ********************* # ok: [localhost] => { # "ansible_facts": { # "data": true # }, # "changed": false # } - name: Check if helloworld is not a valid multicast IP address ansible.builtin.set_fact: data: "{{ 'helloworld' is not ansible.utils.multicast }}"
ip: description: - A string that represents the value against which the test is going to be performed - 'For example: C(224.0.0.1) or C(127.0.0.1)' required: true type: str
data: description: - If jinja test satisfies plugin expression C(true) - If jinja test does not satisfy plugin expression C(false)