Always collect variables for OS

We always need to collect the vars file for the OS. This change
ensures that task will always run without condition. Instead, we
move the condition to only effect the gather facts task above.

Change-Id: Ic94833b5c5c67b716ce1e324103a5509f6a02384
This commit is contained in:
Brendan Shephard 2022-06-08 16:29:49 +10:00
parent fce91ae356
commit 1c9c0a1340

View File

@ -14,27 +14,27 @@
# License for the specific language governing permissions and limitations
# under the License.
- name: Gather facts and variables if they don't exist
block:
- name: Gather facts if they don't exist
setup:
gather_subset: min
- name: Gather facts if they don't exist
setup:
gather_subset: min
when: ansible_distribution is undefined
tags:
- always
# found within the "vars/" path. If no OS files are found the task will skip.
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
tags:
- always
when: not ansible_distribution|default(false)
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
tags:
- always
- name: Check required packages to bootstrap TripleO is installed
command: "rpm -q --whatprovides {{ tripleo_bootstrap_packages_bootstrap | join(' ') }}"