Add handlers for both services

... so docker and docker-distribution restart when config change.

Closes #2
This commit is contained in:
Emilien Macchi 2018-04-13 17:45:23 -07:00
parent 9affee587b
commit b8638c8670
3 changed files with 20 additions and 1 deletions

View File

@ -1,2 +1,14 @@
---
# handlers file for ansible-role-container-registry
# handlers file for ansible-role-container-registry
- name: restart docker
service:
name: docker
state: restarted
listen: "restart docker service"
- name: restart docker-distribution
service:
name: docker-distribution
state: restarted
listen: "restart docker-distribution service"

View File

@ -22,6 +22,7 @@
template:
src: docker-distribution-config.yml.j2
dest: /etc/docker-distribution/registry/config.yml
notify: restart docker-distribution service
- name: enable and start docker-distribution
systemd:

View File

@ -27,12 +27,14 @@
block: |
[Service]
MountFlags=
notify: restart docker service
- name: configure OPTIONS in /etc/sysconfig/docker
lineinfile:
path: /etc/sysconfig/docker
regexp: '^OPTIONS='
line: "OPTIONS='--iptables={{ selinux_enabled|bool }} {{ docker_options }}'"
notify: restart docker service
- name: configure INSECURE_REGISTRY in /etc/sysconfig/docker
lineinfile:
@ -40,12 +42,14 @@
regexp: '^INSECURE_REGISTRY='
line: "INSECURE_REGISTRY='--insecure-registry {{ insecure_registries }}'"
when: insecure_registries != ""
notify: restart docker service
# There is no native way to edit JSON so we use a template.
- name: manage /etc/docker/daemon.json
template:
src: docker-daemon.json.j2
dest: /etc/docker/daemon.json
notify: restart docker service
- name: configure DOCKER_STORAGE_OPTIONS in /etc/sysconfig/docker-storage
lineinfile:
@ -53,6 +57,7 @@
regexp: '^DOCKER_STORAGE_OPTIONS='
line: "DOCKER_STORAGE_OPTIONS=' {{ storage_options }}'"
when: storage_options != ""
notify: restart docker service
- name: configure DOCKER_NETWORK_OPTIONS in /etc/sysconfig/docker-network
lineinfile:
@ -60,6 +65,7 @@
regexp: '^DOCKER_NETWORK_OPTIONS='
line: "DOCKER_NETWORK_OPTIONS=' {{ network_options }}'"
when: storage_options != ""
notify: restart docker service
- name: add deployment user to docker group
user: