Skip to content

Commit fc2ccfd

Browse files
HVSharma12richm
authored andcommitted
fix: add set_vars
Signed-off-by: HVSharma12 <harshvardhan.sharma@suse.com>
1 parent f83d2a2 commit fc2ccfd

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

tasks/set_vars.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
- name: Ensure ansible_facts used by role
3+
setup:
4+
gather_subset: "{{ __firewall_required_facts_subsets }}"
5+
when: __firewall_required_facts |
6+
difference(ansible_facts.keys() | list) | length > 0
7+
8+
- name: Determine if system is ostree and set flag
9+
when: __firewall_is_ostree is not defined
10+
block:
11+
- name: Check if system is ostree
12+
stat:
13+
path: /run/ostree-booted
14+
register: __ostree_booted_stat
15+
16+
- name: Set flag to indicate system is ostree
17+
set_fact:
18+
__firewall_is_ostree: "{{ __ostree_booted_stat.stat.exists }}"
19+
20+
- name: Determine if system is transactional update and set flag
21+
when: not __firewall_is_transactional is defined
22+
block:
23+
- name: Check if transactional-update exists in /sbin
24+
stat:
25+
path: /sbin/transactional-update
26+
register: __transactional_update_stat
27+
28+
- name: Set flag if transactional-update exists
29+
set_fact:
30+
__firewall_is_transactional: "{{ __transactional_update_stat.stat.exists }}"
31+
32+
- name: Set platform/version specific variables
33+
include_vars: "{{ __vars_file }}"
34+
loop:
35+
- "{{ ansible_facts['os_family'] }}.yml"
36+
- "{{ ansible_facts['distribution'] }}.yml"
37+
- >-
38+
{{ ansible_facts['distribution'] ~ '_' ~
39+
ansible_facts['distribution_major_version'] }}.yml
40+
- >-
41+
{{ ansible_facts['distribution'] ~ '_' ~
42+
ansible_facts['distribution_version'] }}.yml
43+
vars:
44+
__vars_file: "{{ role_path }}/vars/{{ item }}"
45+
when: __vars_file is file

0 commit comments

Comments
 (0)