From 924078fb3f5ccf39c0454f4be0e4d6b663005154 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 4 May 2023 23:03:39 +0200 Subject: [PATCH] Add restart if traefik file edited --- roles/traefik/tasks/base.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/roles/traefik/tasks/base.yml b/roles/traefik/tasks/base.yml index 17ff29c..b3d5539 100644 --- a/roles/traefik/tasks/base.yml +++ b/roles/traefik/tasks/base.yml @@ -5,6 +5,7 @@ backup: true src: . dest: traefik/ + register: traefik_copy_results - name: Create proxy network community.docker.docker_network: @@ -12,9 +13,19 @@ state: present become: true +- name: Force update and restart container + community.docker.docker_compose: + project_src: traefik + state: present + pull: true + restarted: true + when: traefik_copy_results.changed + become: true + - name: Update or start container community.docker.docker_compose: project_src: traefik state: present pull: true + when: not traefik_copy_results.changed become: true \ No newline at end of file