From 07a794e9698a5d7071f67129217c7f42b20d8fe0 Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Mon, 4 Nov 2019 19:15:41 -0500 Subject: [PATCH] Added handler to restart Traefik on config changes --- roles/traefik/handlers/main.yml | 5 +++++ roles/traefik/tasks/main.yml | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 roles/traefik/handlers/main.yml diff --git a/roles/traefik/handlers/main.yml b/roles/traefik/handlers/main.yml new file mode 100644 index 0000000..54f8a1f --- /dev/null +++ b/roles/traefik/handlers/main.yml @@ -0,0 +1,5 @@ +- name: Restart Traefik container + docker_container: + name: "{{ traefik_name }}" + image: traefik:{{ traefik_version }} + restart: true diff --git a/roles/traefik/tasks/main.yml b/roles/traefik/tasks/main.yml index 2f05fae..50a3d7f 100644 --- a/roles/traefik/tasks/main.yml +++ b/roles/traefik/tasks/main.yml @@ -2,11 +2,13 @@ copy: src: traefik.yml dest: traefik.yml + notify: Restart Traefik container - name: Start Traefik container docker_container: name: "{{ traefik_name }}" image: traefik:{{ traefik_version }} + state: started restart_policy: always ports: - "{{ traefik_port }}:80"