Skip to content

Commit e29f3b7

Browse files
committed
Gather local ansible facts if not done for roles
While the gathering of ansible local facts has been added to all playbooks that use roles where the facts are required, this commit adds it to the individual roles as well. This is needed for the molecule tests that use the roles directly and not the playbooks, and likewise to enable the roles to operate when used standalone outside of the playbooks. Signed-off-by: James Slagle <[email protected]>
1 parent 8e4825a commit e29f3b7

File tree

24 files changed

+130
-0
lines changed

24 files changed

+130
-0
lines changed

roles/edpm_bootstrap/tasks/fips.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17+
- name: Gather ansible_local facts
18+
ansible.builtin.setup:
19+
filter: ansible_local
20+
when:
21+
- ansible_local is not defined
22+
1723
- name: Check FIPS status
1824
become: true
1925
ansible.builtin.command: fips-mode-setup --is-enabled

roles/edpm_bootstrap/tasks/packages.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
gather_subset:
2020
- "!all"
2121
- "!min"
22+
- "local"
2223
- "distribution"
2324
when: "'distribution' not in ansible_facts"
2425
tags:

roles/edpm_bootstrap/tasks/swap.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17+
- name: Gather ansible_local facts
18+
ansible.builtin.setup:
19+
filter: ansible_local
20+
when:
21+
- ansible_local is not defined
22+
1723
- name: Configure swap file
1824
when:
1925
- not edpm_bootstrap_swap_partition_enabled|bool

roles/edpm_download_cache/tasks/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17+
- name: Gather ansible_local facts
18+
ansible.builtin.setup:
19+
filter: ansible_local
20+
when:
21+
- ansible_local is not defined
22+
1723
- name: Install role requirements
1824
ansible.builtin.include_tasks: install.yml
1925
when: edpm_download_role_install_requirements | bool

roles/edpm_kernel/tasks/kernelargs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17+
- name: Gather ansible_local facts
18+
ansible.builtin.setup:
19+
filter: ansible_local
20+
when:
21+
- ansible_local is not defined
22+
1723
- name: Get the command line args of the node
1824
ansible.builtin.slurp:
1925
src: "/proc/cmdline"

roles/edpm_kernel/tasks/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717

1818
# "edpm_kernel" will search for and load any operating system variable file
1919

20+
- name: Gather ansible_local facts
21+
ansible.builtin.setup:
22+
filter: ansible_local
23+
when:
24+
- ansible_local is not defined
25+
2026
- name: Kernel tuning block
2127
become: true
2228
block:

roles/edpm_libvirt/molecule/default/converge.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
ansible_user_dir: "{{ lookup('env', 'HOME') }}"
1414
when:
1515
- ansible_user_dir is undefined
16+
17+
- name: set bootc fact
18+
set_fact:
19+
ansible_local:
20+
bootc: false
1621
roles:
1722
- role: osp.edpm.edpm_libvirt
1823
vars:

roles/edpm_libvirt/molecule/default/prepare.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
ansible_user_dir: "{{ lookup('env', 'HOME') }}"
3232
when:
3333
- ansible_user_dir is undefined
34+
- name: set bootc fact
35+
set_fact:
36+
ansible_local:
37+
bootc: false
3438
tasks:
3539
- name: Enable package repos
3640
become: true

roles/edpm_libvirt/tasks/install.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
---
2+
- name: Gather ansible_local facts
3+
ansible.builtin.setup:
4+
filter: ansible_local
5+
when:
6+
- ansible_local is not defined
7+
28
- name: Install libvirt packages
39
tags:
410
- install

roles/edpm_nvmeof/tasks/install.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17+
- name: Gather ansible_local facts
18+
ansible.builtin.setup:
19+
filter: ansible_local
20+
when:
21+
- ansible_local is not defined
22+
1723
- name: Load nvme-fabrics
1824
become: true
1925
ansible.builtin.import_role:

0 commit comments

Comments
 (0)