Skip to content

Commit a453e2c

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Refactor the use of include_vars"
2 parents 1c95336 + b1f70ce commit a453e2c

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

playbooks/roles/bifrost-create-vm-nodes/defaults/dummy-defaults.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@
2323
- ansible_distribution == "CentOS"
2424
- ansible_distribution_version|int >= 9
2525

26-
- name: "Load distribution defaults"
27-
include_vars: "{{ item }}"
28-
with_first_found:
29-
- "../defaults/required_defaults_{{ ansible_distribution }}.yml"
30-
- "../defaults/required_defaults_{{ ansible_os_family }}.yml"
31-
32-
- name: "Include OS version-specific defaults"
33-
include_vars: "{{ item }}"
34-
with_first_found:
35-
- "../defaults/required_defaults_{{ ansible_distribution }}_{{ ansible_distribution_release }}.yml"
36-
- "../defaults/required_defaults_{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml"
37-
- "../defaults/dummy-defaults.yml"
26+
- name: Gather variables for each operating system
27+
include_vars: "{{ lookup('first_found', params) }}"
28+
vars:
29+
params:
30+
files:
31+
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
32+
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
33+
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
34+
- "{{ ansible_facts['distribution'] | lower }}.yml"
35+
- "{{ ansible_facts['os_family'] | lower }}.yml"
36+
paths:
37+
- "{{ role_path }}/vars"
3838

3939
- name: "Install required packages"
4040
package:
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)