Add 'roles/ensure_ansible_prereq/' from commit '49dd6fa8cd778a5262644fdccee458811c69e907'

git-subtree-dir: roles/ensure_ansible_prereq
git-subtree-mainline: 512e46bf37
git-subtree-split: 49dd6fa8cd
This commit is contained in:
2026-05-10 21:33:11 -05:00
14 changed files with 540 additions and 0 deletions
+107
View File
@@ -0,0 +1,107 @@
---
# tasks file for ensure_ansible_prereq
- name: 'include vendor / version specific tasks'
when:
- ansible_facts["system"] == 'Linux'
include_tasks:
file: '{{ lookup("first_found", findme ) }}'
vars:
findme:
files:
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml'
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml'
- '{{ ansible_facts["distribution"] }}-default.yml'
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml'
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml'
- '{{ ansible_facts["os_family"]}}-default.yml'
- 'default.yml'
errors: 'ignore'
- name: 'include vendor / version specific variables'
when:
- ansible_facts["system"] == 'Linux'
include_vars:
file: '{{ lookup("first_found", findme ) }}'
name: 'ensure_ansible_prereq'
vars:
findme:
files:
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml'
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml'
- '{{ ansible_facts["distribution"] }}-default.yml'
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml'
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml'
- '{{ ansible_facts["os_family"] }}-default.yml'
- 'default.yml'
paths:
- '../vars/'
errors: 'ignore'
- name: 'package discovery'
when:
- ansible_facts["system"] == 'Linux'
- ansible_facts["packages"] is not defined
ansible.builtin.package_facts:
- name: 'service discovery'
when:
- ansible_facts["system"] == 'Linux'
- ansible_facts["services"] is not defined
ansible.builtin.service_facts:
- name: 'ensure packages'
when:
- ansible_facts["system"] == 'Linux'
- ensure_ansible_prereq is defined
- ensure_ansible_prereq.package_list is defined
- ensure_ansible_prereq.package_list is iterable
ansible.builtin.package:
name: '{{ item.name }}'
state: '{{ item.state }}'
loop: '{{ ensure_ansible_prereq.package_list }}'
loop_control:
label: '{{ item.name }} will be {{ item.state }}'
notify:
- 'ensure_ansible_prereq.package_facts'
- 'ensure_ansible_prereq.service_facts'
- name: 'ensure configurations'
when:
- ansible_facts["system"] == 'Linux'
- ensure_ansible_prereq is defined
- ensure_ansible_prereq.template_list is defined
- ensure_ansible_prereq.template_list is iterable
ansible.builtin.template:
backup: 'no'
dest: '{{ item.dest }}'
group: '{{ item.group | default(omit) }}'
mode: '{{ item.mode | default(omit) }}'
owner: '{{ item.owner | default(omit) }}'
selevel: '{{ iteml.selevel | default(omit) }}'
serole: '{{ item.serole | default(omit) }}'
setype: '{{ item.setype | default(omit) }}'
seuser: '{{ item.seuser | default(omit) }}'
src: '{{ item.src }}'
loop: '{{ ensure_ansible_prereq.template_list }}'
loop_control:
label: '{{ item.dest }} will be ensured'
notify:
- 'ensure_ansible_prereq.package_facts'
- 'ensure_ansible_prereq.service_facts'
- 'ensure_ansible_prereq.service_reload'
- 'ensure_ansible_prereq.service_restart'
- name: 'ensure services'
when:
- ansible_facts["system"] == 'Linux'
- ensure_ansible_prereq is defined
- ensure_ansible_prereq.service_list is defined
- ensure_ansible_prereq.service_list is iterable
ansible.builtin.service:
enabled: '{{ item.enabled }}'
name: '{{ item.name }}'
state: '{{ item.state }}'
loop: '{{ ensure_ansible_prereq.service_list }}'
loop_control:
label: '{{ item.name }} will be {{ item.state }}'
notify:
- 'ensure_ansible_prereq.package_facts'
- 'ensure_ansible_prereq.service_facts'
- name: 'flush handlers'
meta: 'flush_handlers'
...