Initial commit

This commit is contained in:
Richard Megginson
2024-10-22 10:07:09 -06:00
committed by GitHub
commit e898442752
63 changed files with 2164 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
# SPDX-License-Identifier: MIT
---
- name: Set platform/version specific variables
include_tasks: tasks/set_vars.yml
# Examples of some tasks:
- name: Ensure required packages are installed
package:
name: "{{ __template_packages }}"
state: present
use: "{{ (__template_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
- name: Ensure required services are enabled and started
service:
name: "{{ item }}"
state: started
enabled: true
loop: "{{ __template_services }}"
- name: Generate /etc/{{ __template_foo_config }}
template:
src: "{{ __template_foo_config }}.j2"
dest: /etc/{{ __template_foo_config }}
backup: true
mode: "0400"
notify: Handler for template to restart services
+33
View File
@@ -0,0 +1,33 @@
---
- name: Ensure ansible_facts used by role
setup:
gather_subset: "{{ __template_required_facts_subsets }}"
when: __template_required_facts |
difference(ansible_facts.keys() | list) | length > 0
- name: Determine if system is ostree and set flag
when: not __template_is_ostree is defined
block:
- name: Check if system is ostree
stat:
path: /run/ostree-booted
register: __ostree_booted_stat
- name: Set flag to indicate system is ostree
set_fact:
__template_is_ostree: "{{ __ostree_booted_stat.stat.exists }}"
- name: Set platform/version specific variables
include_vars: "{{ __vars_file }}"
loop:
- "{{ ansible_facts['os_family'] }}.yml"
- "{{ ansible_facts['distribution'] }}.yml"
- >-
{{ ansible_facts['distribution'] ~ '_' ~
ansible_facts['distribution_major_version'] }}.yml
- >-
{{ ansible_facts['distribution'] ~ '_' ~
ansible_facts['distribution_version'] }}.yml
vars:
__vars_file: "{{ role_path }}/vars/{{ item }}"
when: __vars_file is file