Refactor for dynamic inventory

This commit is contained in:
2026-01-30 15:12:12 -05:00
parent 6bf17ea35f
commit 286c58b4e3

View File

@@ -1,53 +1,38 @@
# Use with: ansible-playbook -i inventories/inventory.proxmox.yml playbooks/dockerUpdate.yml --limit docker_hosts # Use with: ansible-playbook -i inventories/inventory.proxmox.yml playbooks/dockerUpdate.yml --limit docker_hosts
- name: Update Docker containers for media-app - name: Update Docker containers
hosts: media-app
tasks:
- name: Pull new images for all services
community.docker.docker_compose_v2:
project_src: "{{ item.directory }}"
state: present
loop:
- { directory: "/home/jerick/audiobookshelf" }
- { directory: "/home/jerick/authelia" }
- { directory: "/home/jerick/bazarr" }
- { directory: "/home/jerick/firefly3" }
- { directory: "/home/jerick/gitea" }
- { directory: "/home/jerick/gotify" }
- { directory: "/home/jerick/it-tools" }
- { directory: "/home/jerick/joplin" }
- { directory: "/home/jerick/nginxproxy" }
- { directory: "/home/jerick/ombi" }
- { directory: "/home/jerick/picoshare" }
- { directory: "/home/jerick/romM" }
- { directory: "/home/jerick/tandoor_recipes" }
- { directory: "/home/jerick/tautulli" }
- { directory: "/home/jerick/watchtower" }
- { directory: "/home/jerick/immich" }
- name: Update Docker containers for media-management
hosts: media-management
tasks:
- name: Pull new images for all services
community.docker.docker_compose_v2:
project_src: "{{ item.directory }}"
state: present
loop:
- { directory: "/home/jerick/docker" }
- name: Update Docker containers for plex
hosts: plex
tasks:
- name: Pull new images for all services
community.docker.docker_compose_v2:
project_src: "{{ item.directory }}"
state: present
loop:
- { directory: "/home/jerick/plex" }
- { directory: "/home/jerick/plexAutoLanguages" }
- name: Cleanup
hosts: docker_hosts hosts: docker_hosts
vars:
docker_directories:
Plex:
- /home/jerick/plex
- /home/jerick/plexAutoLanguages
media-app:
- /home/jerick/audiobookshelf
- /home/jerick/authelia
- /home/jerick/bazarr
- /home/jerick/firefly3
- /home/jerick/gitea
- /home/jerick/gotify
- /home/jerick/it-tools
- /home/jerick/joplin
- /home/jerick/nginxproxy
- /home/jerick/ombi
- /home/jerick/picoshare
- /home/jerick/romM
- /home/jerick/tandoor_recipes
- /home/jerick/tautulli
- /home/jerick/watchtower
- /home/jerick/immich
media-management:
- /home/jerick/docker
tasks: tasks:
- name: Pull new images and update containers
community.docker.docker_compose_v2:
project_src: "{{ item }}"
state: present
loop: "{{ docker_directories[inventory_hostname] | default([]) }}"
when: inventory_hostname in docker_directories
- name: Prune Docker Images, Networks, etc - name: Prune Docker Images, Networks, etc
community.docker.docker_prune: community.docker.docker_prune:
containers: true containers: true