2024-09-01 20:26:50 +00:00
|
|
|
---
|
|
|
|
- name: Updates all managed servers
|
2024-09-05 23:26:35 +00:00
|
|
|
hosts: servers
|
2024-09-01 20:26:50 +00:00
|
|
|
become: true
|
|
|
|
vars:
|
|
|
|
group_vars: groups_vars/servers.yml
|
|
|
|
tasks:
|
|
|
|
- name: update package index on all machines
|
|
|
|
ansible.builtin.apt:
|
|
|
|
update_cache: yes
|
2024-09-07 13:12:18 +00:00
|
|
|
when: ansible_os_family == "Debian"
|
2024-09-04 00:54:44 +00:00
|
|
|
|
2024-09-01 20:26:50 +00:00
|
|
|
- name: Upgrade all packages to latest version
|
|
|
|
ansible.builtin.apt:
|
|
|
|
name: "*"
|
|
|
|
state: latest
|
2024-09-04 14:50:19 +00:00
|
|
|
notify: reboot
|
2024-09-07 13:12:18 +00:00
|
|
|
when: ansible_os_family == "Debian"
|
2024-09-04 14:50:19 +00:00
|
|
|
|
2024-09-05 23:26:35 +00:00
|
|
|
|
2024-09-04 14:50:19 +00:00
|
|
|
handlers:
|
|
|
|
- name: reboot
|
|
|
|
ansible.builtin.reboot:
|
|
|
|
test_command: whoami
|
2024-09-05 23:26:35 +00:00
|
|
|
|
|
|
|
- name: this updates the control node
|
|
|
|
hosts: localhost
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- name: update package index on local machine
|
|
|
|
ansible.builtin.apt:
|
2024-09-06 03:36:20 +00:00
|
|
|
update_cache: true
|
2024-09-05 23:26:35 +00:00
|
|
|
|
|
|
|
- name: update all packages to latest version
|
|
|
|
ansible.builtin.apt:
|
|
|
|
name: "*"
|
|
|
|
state: latest
|
2024-09-06 03:36:20 +00:00
|
|
|
|
|
|
|
- name: Upgrade pihole on dns using docker compose
|
|
|
|
hosts: pihole
|
|
|
|
tasks:
|
|
|
|
- name: pull new images via docker compose
|
|
|
|
command:
|
|
|
|
cmd: docker compose -f pihole_compose.yml pull
|
|
|
|
chdir: /home/pollen/pihole
|
|
|
|
|
|
|
|
- name: remove the currently running container
|
|
|
|
command:
|
|
|
|
cmd: docker compose -f pihole_compose.yml down
|
|
|
|
chdir: /home/pollen/pihole
|
|
|
|
|
|
|
|
- name: bring back pihole container
|
|
|
|
command:
|
|
|
|
cmd: docker compose -f pihole_compose.yml up -d
|
|
|
|
chdir: /home/pollen/pihole
|
2024-09-07 13:12:18 +00:00
|
|
|
|
|
|
|
# work in progress for windows host
|
|
|
|
# - name: Upgrade software on windows hosts
|
|
|
|
#hosts: bane
|
|
|
|
#become: true
|
|
|
|
#tasks:
|
|
|
|
#- name: run updates on all windows hosts
|
|
|
|
#ansible.windows.win_whoami:
|