chore: add base role

This commit is contained in:
2025-09-10 21:43:11 +10:00
parent 12444311a4
commit 4a88726fba
12 changed files with 284 additions and 422 deletions

View File

@ -0,0 +1,48 @@
---
- name: Ensure debian-archive-keyring is installed
apt:
name: debian-archive-keyring
state: present
update_cache: yes
become: yes
- name: Update APT cache
apt:
update_cache: yes
force_apt_get: yes
when: ansible_distribution in ['Debian', 'Ubuntu']
- name: Upgrade all packages to latest
apt:
name: "*"
state: latest
force_apt_get: yes
when: ansible_distribution in ['Debian', 'Ubuntu']
register: upgrade_result
- name: Dist-upgrade packages
apt:
upgrade: dist
force_apt_get: yes
when: ansible_distribution in ['Debian', 'Ubuntu']
register: dist_upgrade_result
- name: Install required packages
apt:
name: "{{ install_packages }}"
state: present
become: yes
when: ansible_distribution in ['Debian', 'Ubuntu']
register: install_result
- name: Reboot if required after updates
reboot:
reboot_timeout: 600
test_command: whoami
when:
- upgrade_result.changed or dist_upgrade_result.changed or install_result.changed
- ansible_virtualization_type != "lxc"
become: yes
- name: Gather facts after reboot
setup: