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 - name: Group hosts requiring kayobe user bootstrapping
group_by: group_by:
key: kayobe_user_bootstrap_required_{{ ssh_result.rc != 0 }} key: kayobe_user_bootstrap_required_{{ ssh_result.rc != 0 }}
changed_when: false
- name: Display a message when bootstrapping is required - name: Display a message when bootstrapping is required
debug: debug:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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