Replace docker-compose restart hack with shell handler hack
The docker-compose integration would start 2 of the same container, which does bad things to things like databases!
This commit is contained in:
parent
71086ca291
commit
86a398d6b4
34 changed files with 112 additions and 271 deletions
|
@ -4,3 +4,5 @@ docker_user:
|
|||
|
||||
docker_compose_file_mask: 0664
|
||||
docker_compose_directory_mask: 0775
|
||||
|
||||
docker_update_command: docker-compose down --remove-orphans && docker-compose rm && docker-compose pull && docker-compose up -d
|
||||
|
|
4
ansible/roles/duplicati/handlers/main.yml
Normal file
4
ansible/roles/duplicati/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: restart duplicati
|
||||
shell:
|
||||
chdir: /opt/duplicati
|
||||
cmd: "{{ docker_update_command }}"
|
|
@ -13,17 +13,5 @@
|
|||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
validate: /usr/bin/docker-compose -f %s config
|
||||
register: compose_file
|
||||
notify: restart duplicati
|
||||
become: true
|
||||
|
||||
- name: Cycle duplicati container
|
||||
docker_compose:
|
||||
project_src: /opt/duplicati
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
4
ansible/roles/home-assistant/handlers/main.yml
Normal file
4
ansible/roles/home-assistant/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: restart homeassistant
|
||||
shell:
|
||||
chdir: /opt/home-assistant
|
||||
cmd: "{{ docker_update_command }}"
|
|
@ -20,7 +20,7 @@
|
|||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
validate: /usr/bin/docker-compose -f %s config
|
||||
register: compose_file
|
||||
notify: restart homeassistant
|
||||
become: true
|
||||
|
||||
- name: Install config
|
||||
|
@ -29,7 +29,7 @@
|
|||
dest: /opt/home-assistant/config/configuration.yaml
|
||||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
register: config_file
|
||||
notify: restart homeassistant
|
||||
become: true
|
||||
|
||||
- name: Bump IGMP max memberships
|
||||
|
@ -51,15 +51,3 @@
|
|||
reload: yes
|
||||
sysctl_file: /etc/sysctl.d/99-sysctl.conf
|
||||
become: true
|
||||
|
||||
- name: Cycle home-assistant container
|
||||
docker_compose:
|
||||
project_src: /opt/home-assistant
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
when: compose_file.changed or config_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -16,14 +16,8 @@
|
|||
register: compose_file
|
||||
become: true
|
||||
|
||||
- name: Cycle calibre container
|
||||
docker_compose:
|
||||
project_src: /opt/calibre
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart calibre
|
||||
shell:
|
||||
chdir: /opt/calibre
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -16,14 +16,8 @@
|
|||
register: compose_file
|
||||
become: true
|
||||
|
||||
- name: Cycle folding@home container
|
||||
docker_compose:
|
||||
project_src: /opt/folding-at-home
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart folding-at-home
|
||||
shell:
|
||||
chdir: /opt/folding-at-home
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -44,14 +44,8 @@
|
|||
register: git_mirror_config_file
|
||||
become: true
|
||||
|
||||
- name: Cycle gitea container
|
||||
docker_compose:
|
||||
project_src: /opt/gitea
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart gitea
|
||||
shell:
|
||||
chdir: /opt/gitea
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed or gitea_config_file.changed or git_mirror_config_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -16,14 +16,9 @@
|
|||
register: compose_file
|
||||
become: true
|
||||
|
||||
- name: Cycle gotify container
|
||||
docker_compose:
|
||||
project_src: /opt/gotify
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
|
||||
- name: restart gotify
|
||||
shell:
|
||||
chdir: /opt/gotify
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -16,17 +16,11 @@
|
|||
register: compose_file
|
||||
become: true
|
||||
|
||||
- name: Cycle jellyfin container
|
||||
docker_compose:
|
||||
project_src: /opt/jellyfin
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart jellyfin
|
||||
shell:
|
||||
chdir: /opt/jellyfin
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
||||
- name: Set media permissions
|
||||
cron:
|
||||
|
|
|
@ -19,14 +19,8 @@
|
|||
register: compose_file
|
||||
become: true
|
||||
|
||||
- name: Cycle librespeed container
|
||||
docker_compose:
|
||||
project_src: /opt/librespeed
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart librespeed
|
||||
shell:
|
||||
chdir: /opt/librespeed
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -35,14 +35,8 @@
|
|||
register: config_file
|
||||
become: true
|
||||
|
||||
- name: Cycle nextcloud container
|
||||
docker_compose:
|
||||
project_src: /opt/nextcloud
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart nextcloud
|
||||
shell:
|
||||
chdir: /opt/nextcloud
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed or config_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -16,14 +16,8 @@
|
|||
register: compose_file
|
||||
become: true
|
||||
|
||||
- name: Cycle quassel container
|
||||
docker_compose:
|
||||
project_src: /opt/quassel
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart quassel
|
||||
shell:
|
||||
chdir: /opt/quassel
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -28,17 +28,11 @@
|
|||
register: homeserver_config
|
||||
become: true
|
||||
|
||||
- name: Cycle synapse container
|
||||
docker_compose:
|
||||
project_src: /opt/synapse
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart synapse
|
||||
shell:
|
||||
chdir: /opt/synapse
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed or homeserver_config.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
||||
- name: Install helper scripts
|
||||
git:
|
||||
|
|
|
@ -19,14 +19,8 @@
|
|||
register: compose_file
|
||||
become: true
|
||||
|
||||
- name: Cycle todoist-github container
|
||||
docker_compose:
|
||||
project_src: /opt/todoist-github
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart todoist-github
|
||||
shell:
|
||||
chdir: /opt/todoist-github
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -16,14 +16,8 @@
|
|||
register: compose_file
|
||||
become: true
|
||||
|
||||
- name: Cycle torrent container
|
||||
docker_compose:
|
||||
project_src: /opt/torrent
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart torrent
|
||||
shell:
|
||||
chdir: /opt/torrent
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -32,14 +32,8 @@
|
|||
register: config_file
|
||||
become: true
|
||||
|
||||
- name: Cycle tt-rss container
|
||||
docker_compose:
|
||||
project_src: /opt/tt-rss
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart tt-rss
|
||||
shell:
|
||||
chdir: /opt/tt-rss
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed or config_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -19,14 +19,8 @@
|
|||
register: compose_file
|
||||
become: true
|
||||
|
||||
- name: Cycle wallabag container
|
||||
docker_compose:
|
||||
project_src: /opt/wallabag
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart wallabag
|
||||
shell:
|
||||
chdir: /opt/wallabag
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -16,14 +16,8 @@
|
|||
register: compose_file
|
||||
become: true
|
||||
|
||||
- name: Cycle web-rng container
|
||||
docker_compose:
|
||||
project_src: /opt/web-rng
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
- name: restart web-rng
|
||||
shell:
|
||||
chdir: /opt/web-rng
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
|
@ -16,14 +16,8 @@
|
|||
register: compose_file
|
||||
become: true
|
||||
|
||||
- name: Cycle whoami container
|
||||
docker_compose:
|
||||
project_src: /opt/whoami
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
- name: restart whoami
|
||||
shell:
|
||||
chdir: /opt/whoami
|
||||
cmd: "{{ docker_update_command }}"
|
||||
when: compose_file.changed or config_file.changed
|
||||
|
|
4
ansible/roles/netdata/handlers/main.yml
Normal file
4
ansible/roles/netdata/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: restart netdata
|
||||
shell:
|
||||
chdir: /opt/netdata
|
||||
cmd: "{{ docker_update_command }}"
|
|
@ -13,17 +13,5 @@
|
|||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
validate: /usr/bin/docker-compose -f %s config
|
||||
register: compose_file
|
||||
notify: restart netdata
|
||||
become: true
|
||||
|
||||
- name: Cycle container
|
||||
docker_compose:
|
||||
project_src: /opt/netdata
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
4
ansible/roles/socks-proxy/handlers/main.yml
Normal file
4
ansible/roles/socks-proxy/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: restart socks proxy
|
||||
shell:
|
||||
chdir: /opt/3proxy
|
||||
cmd: "{{ docker_update_command }}"
|
|
@ -16,17 +16,5 @@
|
|||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
validate: /usr/bin/docker-compose -f %s config
|
||||
register: compose_file
|
||||
notify: restart socks proxy
|
||||
become: true
|
||||
|
||||
- name: Cycle container
|
||||
docker_compose:
|
||||
project_src: /opt/3proxy
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
4
ansible/roles/statping/handlers/main.yml
Normal file
4
ansible/roles/statping/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: restart statping
|
||||
shell:
|
||||
chdir: /opt/statping
|
||||
cmd: "{{ docker_update_command }}"
|
|
@ -13,17 +13,5 @@
|
|||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
validate: /usr/bin/docker-compose -f %s config
|
||||
register: compose_file
|
||||
notify: restart statping
|
||||
become: true
|
||||
|
||||
- name: Cycle container
|
||||
docker_compose:
|
||||
project_src: /opt/statping
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
4
ansible/roles/traefik/handlers/main.yml
Normal file
4
ansible/roles/traefik/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: restart traefik
|
||||
shell:
|
||||
chdir: /opt/traefik
|
||||
cmd: "{{ docker_update_command }}"
|
|
@ -20,7 +20,7 @@
|
|||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
validate: /usr/bin/docker-compose -f %s config
|
||||
register: compose_file
|
||||
notify: restart traefik
|
||||
become: true
|
||||
|
||||
- name: Install config
|
||||
|
@ -29,7 +29,7 @@
|
|||
dest: /opt/traefik/traefik/traefik.yml
|
||||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
register: config_file
|
||||
notify: restart traefik
|
||||
become: true
|
||||
|
||||
- name: Install file provider
|
||||
|
@ -38,17 +38,5 @@
|
|||
dest: /opt/traefik/traefik/file-provider.yml
|
||||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
register: file_provider
|
||||
notify: restart traefik
|
||||
become: true
|
||||
|
||||
- name: Cycle container
|
||||
docker_compose:
|
||||
project_src: /opt/traefik
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
when: compose_file.changed or config_file.changed or file_provider.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
4
ansible/roles/upload/handlers/main.yml
Normal file
4
ansible/roles/upload/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: restart upload
|
||||
shell:
|
||||
chdir: /opt/upload
|
||||
cmd: "{{ docker_update_command }}"
|
|
@ -16,17 +16,5 @@
|
|||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
validate: /usr/bin/docker-compose -f %s config
|
||||
register: compose_file
|
||||
notify: restart upload
|
||||
become: true
|
||||
|
||||
- name: Cycle container
|
||||
docker_compose:
|
||||
project_src: /opt/upload
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
4
ansible/roles/watchtower/handlers/main.yml
Normal file
4
ansible/roles/watchtower/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: restart watchtower
|
||||
shell:
|
||||
chdir: /opt/watchtower
|
||||
cmd: "{{ docker_update_command }}"
|
|
@ -13,17 +13,5 @@
|
|||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
validate: /usr/bin/docker-compose -f %s config
|
||||
register: compose_file
|
||||
notify: restart watchtower
|
||||
become: true
|
||||
|
||||
- name: Cycle container
|
||||
docker_compose:
|
||||
project_src: /opt/watchtower
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
4
ansible/roles/website/handlers/main.yml
Normal file
4
ansible/roles/website/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: restart website
|
||||
shell:
|
||||
chdir: /opt/website
|
||||
cmd: "{{ docker_update_command }}"
|
|
@ -13,17 +13,5 @@
|
|||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
validate: /usr/bin/docker-compose -f %s config
|
||||
register: compose_file
|
||||
notify: restart website
|
||||
become: true
|
||||
|
||||
- name: Cycle container
|
||||
docker_compose:
|
||||
project_src: /opt/theorangeone.net
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
remove_volumes: true
|
||||
state: "{{ item }}"
|
||||
when: compose_file.changed
|
||||
loop:
|
||||
- absent
|
||||
- present
|
||||
|
|
Loading…
Reference in a new issue