Skip to content

Commit

Permalink
Fix docker service stop
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbovbel committed Jun 27, 2024
1 parent 5d66faf commit 14e71cb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
8 changes: 7 additions & 1 deletion roles/docker/handlers/configure-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
dest: /etc/docker/docker-compose.yaml
become: true

- name: stop docker
service:
name: docker
state: stopped
become: true

- name: configure containers
shell: |
cd /etc/docker &&
Expand Down Expand Up @@ -71,7 +77,7 @@
# enabled: true
# state: started
become: true
when: "{{ service.value['x-systemd-enabled'] | default(true) }}"
when: service.value['x-systemd-enabled'] | default(true)
no_log: "{{ docker_no_log }}"
loop: "{{ docker.services | dict2items }}"
loop_control:
Expand Down
3 changes: 2 additions & 1 deletion roles/docker/templates/container.service.j2
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# {{ ansible_managed }}

[Unit]
Description=Start docker container {{ service.key }}
Description=Docker container {{ service.key }}
Wants=network-online.target
Before=default.target
BindsTo=docker.service {{ service.value['x-systemd-requires'] | default([]) | join(' ') }}
After=docker.service {{ service.value['x-systemd-requires'] | default([]) | join(' ') }}

[Service]
ExecStart=/usr/bin/docker start {{ service.key }} -a
ExecStop=/usr/bin/docker stop {{ service.key }}
Type=simple
SyslogIdentifier={{ service.key }}
Restart=on-failure
Expand Down
20 changes: 15 additions & 5 deletions roles/media-server/handlers/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,33 @@
become: true

- name: restart sonarr
shell: docker restart sonarr
service:
name: sonarr
state: restarted
become: true

- name: restart radarr
shell: docker restart radarr
service:
name: radarr
state: restarted
become: true

- name: restart jackett
shell: docker restart jackett
service:
name: jackett
state: restarted
become: true

- name: restart deluge
shell: docker restart deluge
service:
name: deluge
state: restarted
become: true

- name: restart tautulli
shell: docker restart tautulli
service:
name: tautulli
state: restarted
become: true

- name: enable cleanup-downloads
Expand Down

0 comments on commit 14e71cb

Please sign in to comment.