This commit is contained in:
Roxedus 2021-08-17 00:13:23 +02:00
parent 51ce124ece
commit bdbc512647
Signed by: Roxedus
GPG Key ID: 9B4E311961C63639

View File

@ -52,6 +52,11 @@
test_command: uptime
when: new_hostname.changed
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 1
roles:
- role: geerlingguy.ntp
- role: geerlingguy.security
@ -171,10 +176,10 @@
# https://www.cyberciti.biz/faq/ansible-apt-update-all-packages-on-ubuntu-debian-linux/
- name: Update packages
ansible.builtin.apt:
update_cache: true
force_apt_get: true
update_cache: "True"
force_apt_get: "True"
cache_valid_time: 3600
upgrade: true
upgrade: "True"
- name: Remove ubuntu motd spam
ansible.builtin.file:
@ -185,11 +190,18 @@
- 50-landscape-sysinfo
- 50-motd-news
- 80-livepatch
- 90-updates-available
- 95-hwe-eol
when: ansible_distribution == 'Ubuntu'
- name: Update PiHole
- name: Check if pi-hole is installed
when: inventory_hostname in groups['piholes']
stat:
path: "/usr/local/bin/pihole"
register: pihole_exec
- name: Update PiHole
when: inventory_hostname in groups['piholes'] and pihole_exec.stat.exists
become: true
ansible.builtin.command:
argv:
@ -198,9 +210,12 @@
- name: Check if a reboot is needed for Debian and Ubuntu boxes
register: reboot_required_file
stat: path=/var/run/reboot-required get_md5=no
stat:
path: /var/run/reboot-required
get_md5: no
- name: Reboot the server
throttle: 1
ansible.builtin.reboot:
msg: "Reboot initiated by Ansible due to kernel updates"
connect_timeout: 5