Avoid fact gathering for group_by

There are a few places where we have a play with one task that uses the
group_by module to generate groups that are used in a subsequent play.
These plays do not need to gather facts for their target hosts.

In particular, the kolla-openstack.yml playbook should really be able to
operate without access to remote hosts.

This change also adds changed_when: false to all group_by tasks, since
they show as changed but haven't really made any changes outside of
Ansible.

TrivialFix

Change-Id: I18f67eda4e48058f3f402b9d0e692d6eeb02855f
This commit is contained in:
Mark Goddard 2021-03-04 14:54:13 +00:00
parent a9bf637cc5
commit 388dfa369c
10 changed files with 20 additions and 6 deletions

View File

@ -26,6 +26,7 @@
- name: Group hosts requiring kayobe user bootstrapping
group_by:
key: kayobe_user_bootstrap_required_{{ ssh_result.rc != 0 }}
changed_when: false
- name: Display a message when bootstrapping is required
debug:

View File

@ -1,6 +1,7 @@
---
- name: Check whether Ironic is enabled
hosts: controllers
gather_facts: False
tags:
- config
- config-validation
@ -10,9 +11,11 @@
- name: Create controllers group with ironic enabled
group_by:
key: "controllers_with_ironic_enabled_{{ kolla_enable_ironic | bool }}"
changed_when: false
- name: Ensure locally built Ironic Python Agent images are copied
hosts: controllers_with_ironic_enabled_True[0]
gather_facts: False
tags:
- kolla-ansible
- kolla-openstack

View File

@ -30,6 +30,7 @@
- name: Group overcloud hosts by their BMC type
group_by:
key: "overcloud_with_bmcs_of_type_{{ bmc_type | default('unknown') }}"
changed_when: false
- name: Check whether any changes to nodes' BIOS and RAID configuration are required
hosts: overcloud_with_bmcs_of_type_idrac

View File

@ -1,16 +1,17 @@
---
- name: Check whether Monasca is enabled
hosts: overcloud
gather_facts: False
tags:
- grafana
tasks:
- name: Create monitoring group with grafana enabled
group_by:
key: "monitoring_with_grafana_enabled_{{ kolla_enable_monasca | bool }}"
changed_when: false
- name: Set the Monasca control plane project ID
hosts: monitoring_with_grafana_enabled_True[0]
gather_facts: False
tags:
- grafana
vars:

View File

@ -17,6 +17,7 @@
- name: Check whether Ironic is enabled
hosts: controllers
gather_facts: False
tags:
- introspection-rules
- introspection-rules-dell-lldp-workaround
@ -24,6 +25,7 @@
- name: Create controllers group with ironic enabled
group_by:
key: "controllers_for_introspection_rules_dell_lldp_workaround_{{ kolla_enable_ironic | bool }}"
changed_when: false
- name: Group controller hosts in systems requiring the workaround
hosts: controllers_for_introspection_rules_dell_lldp_workaround_True
@ -35,11 +37,11 @@
- name: Group controller hosts in systems requiring the Dell switch LLDP workaround
group_by:
key: "controllers_require_workaround_{{ groups[inspector_dell_switch_lldp_workaround_group] | default([]) | length > 0 }}"
changed_when: false
- name: Ensure introspection rules for Dell switch LLDP workarounds are registered in Ironic Inspector
# Only required to run on a single host.
hosts: controllers_require_workaround_True[0]
gather_facts: False
tags:
- introspection-rules
- introspection-rules-dell-lldp-workaround

View File

@ -1,17 +1,18 @@
---
- name: Check whether Ironic is enabled
hosts: controllers
gather_facts: False
tags:
- introspection-rules
tasks:
- name: Create controllers group with ironic enabled
group_by:
key: "controllers_for_introspection_rules_{{ kolla_enable_ironic | bool }}"
changed_when: false
- name: Ensure introspection rules are registered in Ironic Inspector
# Only required to run on a single host.
hosts: controllers_for_introspection_rules_True[0]
gather_facts: False
tags:
- introspection-rules
vars:

View File

@ -6,16 +6,17 @@
- name: Check whether Ironic is enabled
hosts: controllers
gather_facts: False
tags:
- ipa-build
tasks:
- name: Create controllers group with ironic enabled
group_by:
key: "controllers_for_ipa_build_{{ kolla_enable_ironic | bool }}"
changed_when: false
- name: Ensure Ironic Python Agent images are built and installed
hosts: controllers_for_ipa_build_True[0]
gather_facts: False
tags:
- ipa-build
vars:

View File

@ -1,16 +1,17 @@
---
- name: Check whether Ironic is enabled
hosts: controllers
gather_facts: False
tags:
- ipa-images
tasks:
- name: Create controllers group with ironic enabled
group_by:
key: "controllers_for_ipa_images_{{ kolla_enable_ironic | bool }}"
changed_when: false
- name: Ensure Ironic Python Agent (IPA) images are downloaded and registered
hosts: controllers_for_ipa_images_True[0]
gather_facts: False
tags:
- ipa-images
vars:

View File

@ -53,10 +53,12 @@
- name: Group hosts by their switch type
group_by:
key: "switches_of_type_{{ switch_type }}"
changed_when: false
- name: Group hosts by whether display mode is set
group_by:
key: "switches_in_display_mode_{{ physical_network_display | bool }}"
changed_when: false
- name: Add discovery interface configuration when enabling discovery
set_fact:

View File

@ -1,6 +1,7 @@
---
- name: Check whether Ironic is enabled
hosts: controllers
gather_facts: False
tags:
- provision-net
- cleaning-net
@ -8,11 +9,11 @@
- name: Create controllers group with ironic enabled
group_by:
key: "controllers_for_provision_net_{{ kolla_enable_ironic | bool }}"
changed_when: false
- name: Ensure provisioning and cleaning networks and subnets are registered in neutron
# Only required to run on a single host.
hosts: controllers_for_provision_net_True[0]
gather_facts: False
vars:
venv: "{{ virtualenv_path }}/openstacksdk"
provision_net: