64 lines
1.5 KiB
YAML
64 lines
1.5 KiB
YAML
---
|
|
- name: Updates all managed servers
|
|
hosts: servers
|
|
become: true
|
|
vars:
|
|
group_vars: groups_vars/servers.yml
|
|
tasks:
|
|
- name: update package index on all machines
|
|
ansible.builtin.apt:
|
|
update_cache: yes
|
|
when: ansible_os_family == "Debian"
|
|
|
|
- name: Upgrade all packages to latest version
|
|
ansible.builtin.apt:
|
|
name: "*"
|
|
state: latest
|
|
notify: reboot
|
|
when: ansible_os_family == "Debian"
|
|
|
|
|
|
handlers:
|
|
- name: reboot
|
|
ansible.builtin.reboot:
|
|
test_command: whoami
|
|
|
|
- name: this updates the control node
|
|
hosts: localhost
|
|
become: true
|
|
tasks:
|
|
- name: update package index on local machine
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
|
|
- name: update all packages to latest version
|
|
ansible.builtin.apt:
|
|
name: "*"
|
|
state: latest
|
|
|
|
- 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
|
|
|
|
# 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:
|