QoL
This commit is contained in:
parent
51ce124ece
commit
bdbc512647
@ -52,6 +52,11 @@
|
|||||||
test_command: uptime
|
test_command: uptime
|
||||||
when: new_hostname.changed
|
when: new_hostname.changed
|
||||||
|
|
||||||
|
- name: Update apt cache
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: true
|
||||||
|
cache_valid_time: 1
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: geerlingguy.ntp
|
- role: geerlingguy.ntp
|
||||||
- role: geerlingguy.security
|
- role: geerlingguy.security
|
||||||
@ -171,10 +176,10 @@
|
|||||||
# https://www.cyberciti.biz/faq/ansible-apt-update-all-packages-on-ubuntu-debian-linux/
|
# https://www.cyberciti.biz/faq/ansible-apt-update-all-packages-on-ubuntu-debian-linux/
|
||||||
- name: Update packages
|
- name: Update packages
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
update_cache: true
|
update_cache: "True"
|
||||||
force_apt_get: true
|
force_apt_get: "True"
|
||||||
cache_valid_time: 3600
|
cache_valid_time: 3600
|
||||||
upgrade: true
|
upgrade: "True"
|
||||||
|
|
||||||
- name: Remove ubuntu motd spam
|
- name: Remove ubuntu motd spam
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
@ -185,11 +190,18 @@
|
|||||||
- 50-landscape-sysinfo
|
- 50-landscape-sysinfo
|
||||||
- 50-motd-news
|
- 50-motd-news
|
||||||
- 80-livepatch
|
- 80-livepatch
|
||||||
|
- 90-updates-available
|
||||||
- 95-hwe-eol
|
- 95-hwe-eol
|
||||||
when: ansible_distribution == 'Ubuntu'
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
- name: Update PiHole
|
- name: Check if pi-hole is installed
|
||||||
when: inventory_hostname in groups['piholes']
|
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
|
become: true
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
argv:
|
argv:
|
||||||
@ -198,9 +210,12 @@
|
|||||||
|
|
||||||
- name: Check if a reboot is needed for Debian and Ubuntu boxes
|
- name: Check if a reboot is needed for Debian and Ubuntu boxes
|
||||||
register: reboot_required_file
|
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
|
- name: Reboot the server
|
||||||
|
throttle: 1
|
||||||
ansible.builtin.reboot:
|
ansible.builtin.reboot:
|
||||||
msg: "Reboot initiated by Ansible due to kernel updates"
|
msg: "Reboot initiated by Ansible due to kernel updates"
|
||||||
connect_timeout: 5
|
connect_timeout: 5
|
||||||
|
Loading…
Reference in New Issue
Block a user