--- - name: Check if network interface exists ansible.builtin.fail: msg: "{{ radosgw_interface }} does not exist on {{ inventory_hostname }}" when: radosgw_interface not in ansible_facts['interfaces'] - name: Check if network interface is active ansible.builtin.fail: msg: "{{ radosgw_interface }} is not active on {{ inventory_hostname }}" when: hostvars[inventory_hostname]['ansible_facts'][(radosgw_interface | replace('-', '_'))]['active'] == "false" - name: Check if network interface has an IPv4 address ansible.builtin.fail: msg: "{{ radosgw_interface }} does not have any IPv4 address on {{ inventory_hostname }}" when: - ip_version == "ipv4" - hostvars[inventory_hostname]['ansible_facts'][(radosgw_interface | replace('-', '_'))]['ipv4'] is not defined - name: Check if network interface has an IPv6 address ansible.builtin.fail: msg: "{{ radosgw_interface }} does not have any IPv6 address on {{ inventory_hostname }}" when: - ip_version == "ipv6" - hostvars[inventory_hostname]['ansible_facts'][(radosgw_interface | replace('-', '_'))]['ipv6'] is not defined