initial commit

This commit is contained in:
hiperman
2026-01-30 20:13:58 -05:00
commit a28fcbd942
31 changed files with 1022 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
- name: Update and upgrade apk packages (Alpine)
community.general.apk:
upgrade: true
update_cache: true
when: ansible_os_family == 'Alpine'

View File

@@ -0,0 +1,22 @@
---
- name: Update and upgrade apt packages (Debian/Ubuntu)
ansible.builtin.apt:
upgrade: true
update_cache: true
cache_valid_time: 21600 # 6 hours
- name: Remove unused packages
ansible.builtin.apt:
autoremove: true
purge: true
- name: Check if reboot required
ansible.builtin.stat:
path: /var/run/reboot-required
register: reboot_required_file
- name: Call reboot handler if reboot required
ansible.builtin.debug:
msg: "Reboot is required"
when: reboot_required_file.stat.exists
notify: Reboot system

View File

@@ -0,0 +1,19 @@
---
- name: Use appropriate tasks for given distribution
ansible.builtin.set_fact:
task_distro_file: "{{ ansible_os_family | lower }}.yaml"
- name: Verify that the distribution is supported
become: false
ansible.builtin.stat:
path: "{{ role_path }}/tasks/{{ task_distro_file }}"
register: distro_stat_result
delegate_to: localhost
- name: Fail if the distribution is not supported
ansible.builtin.fail:
msg: "Unsupported distribution: {{ ansible_os_family }}"
when: not distro_stat_result.stat.exists
- name: Include distribution specific update tasks
ansible.builtin.include_tasks: "{{ task_distro_file }}"