2018-07-23 22:02:43 +08:00
|
|
|
---
|
|
|
|
- name: "fail if {{ monitor_interface }} does not exist on {{ inventory_hostname }}"
|
|
|
|
fail:
|
|
|
|
msg: "{{ monitor_interface }} does not exist on {{ inventory_hostname }}"
|
2021-03-03 22:43:50 +08:00
|
|
|
when: monitor_interface not in ansible_facts['interfaces']
|
2018-07-23 22:02:43 +08:00
|
|
|
|
|
|
|
- name: "fail if {{ monitor_interface }} is not active on {{ inventory_hostname }}"
|
|
|
|
fail:
|
|
|
|
msg: "{{ monitor_interface }} is not active on {{ inventory_hostname }}"
|
2021-03-03 22:43:50 +08:00
|
|
|
when: not hostvars[inventory_hostname]['ansible_facts'][(monitor_interface | replace('-', '_'))]['active']
|
2018-07-23 22:02:43 +08:00
|
|
|
|
|
|
|
- name: "fail if {{ monitor_interface }} does not have any ip v4 address on {{ inventory_hostname }}"
|
|
|
|
fail:
|
|
|
|
msg: "{{ monitor_interface }} does not have any IPv4 address on {{ inventory_hostname }}"
|
|
|
|
when:
|
|
|
|
- ip_version == "ipv4"
|
2021-03-03 22:43:50 +08:00
|
|
|
- hostvars[inventory_hostname]['ansible_facts'][(monitor_interface | replace('-', '_'))]['ipv4'] is not defined
|
2018-07-23 22:02:43 +08:00
|
|
|
|
|
|
|
- name: "fail if {{ monitor_interface }} does not have any ip v6 address on {{ inventory_hostname }}"
|
|
|
|
fail:
|
|
|
|
msg: "{{ monitor_interface }} does not have any IPv6 address on {{ inventory_hostname }}"
|
|
|
|
when:
|
|
|
|
- ip_version == "ipv6"
|
2021-03-03 22:43:50 +08:00
|
|
|
- hostvars[inventory_hostname]['ansible_facts'][(monitor_interface | replace('-', '_'))]['ipv6'] is not defined
|