|
| 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