From b9f0d39bf8d466c007fe27a169b345454dd48a54 Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Thu, 5 Sep 2024 23:36:20 -0400 Subject: [PATCH] all machines incorporated into ansible --- inventory | 2 +- playbooks/update_upgrade.yml | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/inventory b/inventory index be6f71f..b591b0f 100644 --- a/inventory +++ b/inventory @@ -6,7 +6,7 @@ doc ansible_user=pollen [local] proxmox ansible_user=root -dns ansible_user=pollen +pihole ansible_user=pollen [servers:children] doc diff --git a/playbooks/update_upgrade.yml b/playbooks/update_upgrade.yml index 220bdb2..0c1ebc2 100644 --- a/playbooks/update_upgrade.yml +++ b/playbooks/update_upgrade.yml @@ -15,12 +15,6 @@ state: latest notify: reboot - - name: Upgrade pihole on dns using docker compose - community.docker.docker_compose: - project_src: /home/pollen/pihole - state: present - recreate: always - handlers: - name: reboot @@ -33,9 +27,27 @@ tasks: - name: update package index on local machine ansible.builtin.apt: - update_cache: yes + 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