Skip to content
Snippets Groups Projects
Verified Commit ad1b26d9 authored by Chris Croome's avatar Chris Croome
Browse files

check ansible_host for all hosts

parent e654dfca
No related branches found
No related tags found
No related merge requests found
Pipeline #31941 passed
...@@ -17,11 +17,44 @@ ...@@ -17,11 +17,44 @@
- name: Icinga checks - name: Icinga checks
block: block:
- name: Each host requires a ansible_host variable to be defined - name: "Ensure that ansible_host is defined for the icinga_master_nodes"
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- hostvars[inventory_hostname].ansible_host is defined - hostvars[icinga_agent_node].ansible_host is defined
- hostvars[icinga_agent_node].ansible_host is ansible.utils.ip
quiet: "{% if ansible_verbosity == 0 %}true{% else %}false{% endif %}" quiet: "{% if ansible_verbosity == 0 %}true{% else %}false{% endif %}"
loop: "{{ groups['icinga_master_nodes'] }}"
loop_control:
loop_var: icinga_agent_node
when:
- groups['icinga_master_nodes'] is defined
- groups['icinga_master_nodes'] | length > 0
- name: "Ensure that ansible_host is defined for the icinga_agent_nodes"
ansible.builtin.assert:
that:
- hostvars[icinga_agent_node].ansible_host is defined
- hostvars[icinga_agent_node].ansible_host is ansible.utils.ip
quiet: "{% if ansible_verbosity == 0 %}true{% else %}false{% endif %}"
loop: "{{ groups['icinga_agent_nodes'] }}"
loop_control:
loop_var: icinga_agent_node
when:
- groups['icinga_agent_nodes'] is defined
- groups['icinga_agent_nodes'] | length > 0
- name: "Ensure that ansible_host is defined for the icinga_remote_nodes"
ansible.builtin.assert:
that:
- hostvars[icinga_agent_node].ansible_host is defined
- hostvars[icinga_agent_node].ansible_host is ansible.utils.ip
quiet: "{% if ansible_verbosity == 0 %}true{% else %}false{% endif %}"
loop: "{{ groups['icinga_remote_nodes'] }}"
loop_control:
loop_var: icinga_agent_node
when:
- groups['icinga_remote_nodes'] is defined
- groups['icinga_remote_nodes'] | length > 0
tags: tags:
- icinga - icinga
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment