Restart Docker daemon if config changed

This commit is contained in:
Sam A. 2022-12-25 17:55:40 +01:00
parent 6b7636a4ed
commit c85fdf12b5
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA
5 changed files with 14 additions and 9 deletions

View file

@ -1,3 +1,4 @@
# vim: ft=yaml.ansible
---
base_domain: sapti.me
base_volume: "{{ hdd_mount_point }}/apps"

View file

@ -1,3 +1,4 @@
# vim: ft=yaml.ansible
---
- name: Add Docker PGP key
apt_key:
@ -36,13 +37,6 @@
- docker
- docker-compose
- name: Copy Docker daemon config file
template:
src: daemon.json.j2
dest: /etc/docker/daemon.json
owner: root
mode: u=rw,g=r,o=r
- name: Set up Docker services
import_tasks: services.yml
tags:

View file

@ -1,10 +1,18 @@
# vim: ft=yaml.ansible
---
- name: Start but disable Docker daemon
- name: Copy Docker daemon config file
template:
src: daemon.json.j2
dest: /etc/docker/daemon.json
owner: root
mode: u=rw,g=r,o=r
register: daemon_config
- name: (Disable and) start Docker daemon
service:
name: "{{ item }}"
enabled: false
state: started
state: "{{ 'restarted' if daemon_config.changed else 'started' }}"
loop:
- docker.socket
- docker.service

View file

@ -1,2 +1,3 @@
# vim: ft=yaml.ansible
---
ssh_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPd/4fQV7CL8/KVwbo/phiV5UdXFBIDlkZ+ps8C7FeRf

View file

@ -1,3 +1,4 @@
# vim: ft=yaml.ansible
---
- name: Configure system packages
import_tasks: pkgs.yml