From 3446cc44ff9b489a62463801a77c7791eb390d59 Mon Sep 17 00:00:00 2001 From: Chris Croome <chris@webarchitects.co.uk> Date: Sat, 29 Oct 2022 13:40:38 +0100 Subject: [PATCH] whitespace tweaks --- tasks/agent_check.yml | 10 +++++----- tasks/master_agents.yml | 28 ++++++++++++++-------------- tasks/master_api.yml | 14 +++++++------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tasks/agent_check.yml b/tasks/agent_check.yml index d9d2be4..eed2bee 100644 --- a/tasks/agent_check.yml +++ b/tasks/agent_check.yml @@ -45,7 +45,7 @@ # Note this removes remote nodes from the list - name: Set an array of all configured Icinga agent nodes for Ansible >= 2.13 ansible.builtin.set_fact: - icinga_hosts_existing: "{{ icinga_hosts | default([]) + [ host.host_name ] }}" + icinga_hosts_existing: "{{ icinga_hosts | default([]) + [host.host_name] }}" when: - ansible_version.full is version('2.13.0', '>=') - host.host_name not in groups['icinga_remote_nodes'] @@ -76,12 +76,12 @@ - name: Print Icinga agent nodes that need to be configured ansible.builtin.debug: var: icinga_hosts_missing - when: ( icinga_hosts_missing is defined ) and ( icinga_hosts_missing | length > 0 ) + when: (icinga_hosts_missing is defined) and (icinga_hosts_missing | length > 0) when: - - ( icinga_which_icingacli.rc == 0 ) - - ( groups['icinga_master_nodes'] is defined ) and ( groups['icinga_agent_nodes'] is defined ) - - ( inventory_hostname in groups['icinga_master_nodes'] ) or ( inventory_hostname in groups['icinga_agent_nodes'] ) + - (icinga_which_icingacli.rc == 0) + - (groups['icinga_master_nodes'] is defined) and (groups['icinga_agent_nodes'] is defined) + - (inventory_hostname in groups['icinga_master_nodes']) or (inventory_hostname in groups['icinga_agent_nodes']) tags: - icinga ... diff --git a/tasks/master_agents.yml b/tasks/master_agents.yml index 8013ab8..1c88c6c 100644 --- a/tasks/master_agents.yml +++ b/tasks/master_agents.yml @@ -14,34 +14,34 @@ ansible.builtin.debug: msg: "{{ groups['icinga_agent_nodes'] }}" verbosity: 2 - when: ( groups['icinga_agent_nodes'] is defined ) + when: (groups['icinga_agent_nodes'] is defined) - name: Debug groups['icinga_remote_nodes'] ansible.builtin.debug: msg: "{{ groups['icinga_remote_nodes'] }}" verbosity: 2 - when: ( groups['icinga_remote_nodes'] is defined ) + when: (groups['icinga_remote_nodes'] is defined) - name: Set a fact for the list of the node hosts required on the master node when there are only remote nodes ansible.builtin.set_fact: icinga_agent_node_hosts_required: "{{ groups['icinga_remote_nodes'] }}" when: - - ( groups['icinga_agent_nodes'] is not defined ) or ( groups['icinga_agent_nodes'] == [] ) - - ( groups['icinga_remote_nodes'] is defined ) and ( groups['icinga_remote_nodes'] != [] ) + - (groups['icinga_agent_nodes'] is not defined) or (groups['icinga_agent_nodes'] == []) + - (groups['icinga_remote_nodes'] is defined) and (groups['icinga_remote_nodes'] != []) - name: Set a fact for the list of the node hosts required on the master node when there are only agent nodes ansible.builtin.set_fact: icinga_agent_node_hosts_required: "{{ groups['icinga_agent_nodes'] }}" when: - - ( groups['icinga_agent_nodes'] is defined ) and ( groups['icinga_agent_nodes'] != [] ) - - ( groups['icinga_remote_nodes'] is not defined ) or ( groups['icinga_remote_nodes'] == [] ) + - (groups['icinga_agent_nodes'] is defined) and (groups['icinga_agent_nodes'] != []) + - (groups['icinga_remote_nodes'] is not defined) or (groups['icinga_remote_nodes'] == []) - name: Set a fact for the list of the node hosts required on the master node when there are both remote nodes and agent nodes ansible.builtin.set_fact: icinga_agent_node_hosts_required: "{{ groups['icinga_agent_nodes'] + groups['icinga_remote_nodes'] }}" when: - - ( groups['icinga_agent_nodes'] is defined ) and ( groups['icinga_agent_nodes'] != [] ) - - ( groups['icinga_remote_nodes'] is defined ) and ( groups['icinga_remote_nodes'] != [] ) + - (groups['icinga_agent_nodes'] is defined) and (groups['icinga_agent_nodes'] != []) + - (groups['icinga_remote_nodes'] is defined) and (groups['icinga_remote_nodes'] != []) - name: Print the list of agent node hosts required on the master node ansible.builtin.debug: @@ -71,7 +71,7 @@ - name: Generate a list of all Icinga node hostnames on the master node for Ansible < 2.13 ansible.builtin.set_fact: - icinga_agent_node_hosts_present: "{{ icinga_agent_node_hosts_present | default ([]) }} + [ '{{ file.path | basename | regex_replace('[.]conf$') }}' ]" + icinga_agent_node_hosts_present: "{{ icinga_agent_node_hosts_present | default ([]) }} + ['{{ file.path | basename | regex_replace('[.]conf$') }}']" loop: "{{ icinga_agent_node_host_files.files }}" loop_control: loop_var: file @@ -80,7 +80,7 @@ - name: Generate a list of all Icinga node hostnames on the master node for Ansible >= 2.13 ansible.builtin.set_fact: - icinga_agent_node_hosts_present: "{{ icinga_agent_node_hosts_present | default ([]) + [ file.path | basename | regex_replace('[.]conf$') ] }}" + icinga_agent_node_hosts_present: "{{ icinga_agent_node_hosts_present | default ([]) + [file.path | basename | regex_replace('[.]conf$')] }}" loop: "{{ icinga_agent_node_host_files.files }}" loop_control: loop_var: file @@ -111,8 +111,8 @@ label: "{{ host }}" when: - - ( icinga_agent_node_host_files is defined ) - - ( icinga_agent_node_host_files.matched > 0 ) + - (icinga_agent_node_host_files is defined) + - (icinga_agent_node_host_files.matched > 0) tags: - icinga @@ -128,8 +128,8 @@ # - name: Check that agent node hosts are connected when: - - ( icinga_master_node is defined ) and ( inventory_hostname == icinga_master_node ) - - ( groups['icinga_master_nodes'] is defined ) and ( inventory_hostname in groups['icinga_master_nodes'] ) + - (icinga_master_node is defined) and (inventory_hostname == icinga_master_node) + - (groups['icinga_master_nodes'] is defined) and (inventory_hostname in groups['icinga_master_nodes']) tags: - icinga ... diff --git a/tasks/master_api.yml b/tasks/master_api.yml index 6386f27..d35efc7 100644 --- a/tasks/master_api.yml +++ b/tasks/master_api.yml @@ -64,7 +64,7 @@ - name: Generate an array of all Icinga API user files for Ansible < 2.13 ansible.builtin.set_fact: - icinga_api_users_present: "{{ icinga_api_users_present | default ([]) }} + [ '{{ file.path | basename | regex_replace('[.]conf$') }}' ]" + icinga_api_users_present: "{{ icinga_api_users_present | default ([]) }} + ['{{ file.path | basename | regex_replace('[.]conf$') }}']" loop: "{{ icinga_api_user_files.files }}" loop_control: loop_var: file @@ -73,7 +73,7 @@ - name: Generate an array of all Icinga API user files for Ansible >= 2.13 ansible.builtin.set_fact: - icinga_api_users_present: "{{ icinga_api_users_present | default ([]) + [ file.path | basename | regex_replace('[.]conf$') ] }}" + icinga_api_users_present: "{{ icinga_api_users_present | default ([]) + [file.path | basename | regex_replace('[.]conf$')] }}" loop: "{{ icinga_api_user_files.files }}" loop_control: loop_var: file @@ -104,8 +104,8 @@ label: "{{ user }}" when: - - ( icinga_api_user_files is defined ) - - ( icinga_api_user_files.matched > 0 ) + - (icinga_api_user_files is defined) + - (icinga_api_user_files.matched > 0) tags: - icinga @@ -117,9 +117,9 @@ label: "{{ user.key }}" when: - - ( icinga_api_users is defined ) - - ( icinga_master_node is defined ) and ( inventory_hostname == icinga_master_node ) - - ( groups['icinga_master_nodes'] is defined ) and ( inventory_hostname in groups['icinga_master_nodes'] ) + - (icinga_api_users is defined) + - (icinga_master_node is defined) and (inventory_hostname == icinga_master_node) + - (groups['icinga_master_nodes'] is defined) and (inventory_hostname in groups['icinga_master_nodes']) tags: - icinga ... -- GitLab