diff --git a/roles/cloud/tasks/base.yml b/roles/cloud/tasks/base.yml index 0fcf711..c3e2943 100644 --- a/roles/cloud/tasks/base.yml +++ b/roles/cloud/tasks/base.yml @@ -21,19 +21,10 @@ - { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' } register: cloud_copy_templates_results -- name: Force update and restart container +- name: Update and restart container community.docker.docker_compose: project_src: cloud state: present pull: true - restarted: true - when: cloud_copy_files_results.changed or cloud_copy_templates_results.changed - become: true - -- name: Update or start container - community.docker.docker_compose: - project_src: cloud - state: present - pull: true - when: not cloud_copy_files_results.changed and not cloud_copy_templates_results.changed + restarted: "{{ cloud_copy_files_results.changed or cloud_copy_templates_results.changed }}" become: true \ No newline at end of file diff --git a/roles/home_assistant/tasks/base.yml b/roles/home_assistant/tasks/base.yml index 063a322..240cf9b 100644 --- a/roles/home_assistant/tasks/base.yml +++ b/roles/home_assistant/tasks/base.yml @@ -14,19 +14,10 @@ - { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' } register: home_assistant_copy_templates_results -- name: Force update and restart container +- name: Update and restart container community.docker.docker_compose: project_src: home_assistant state: present pull: true - restarted: true - when: home_assistant_copy_templates_results.changed - become: true - -- name: Update or start container - community.docker.docker_compose: - project_src: home_assistant - state: present - pull: true - when: not home_assistant_copy_templates_results.changed + restarted: "{{ home_assistant_copy_templates_results.changed }}" become: true \ No newline at end of file diff --git a/roles/matrix/tasks/base.yml b/roles/matrix/tasks/base.yml index 931ec23..d5a5d3b 100644 --- a/roles/matrix/tasks/base.yml +++ b/roles/matrix/tasks/base.yml @@ -21,19 +21,10 @@ - { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' } register: matrix_copy_templates_results -- name: Force update and restart container +- name: Update and restart container community.docker.docker_compose: project_src: matrix state: present pull: true - restarted: true - when: matrix_copy_files_results.changed or matrix_copy_templates_results.changed + restarted: "{{ matrix_copy_files_results.changed or matrix_copy_templates_results.changed }}" become: true - -- name: Update or start container - community.docker.docker_compose: - project_src: matrix - state: present - pull: true - when: not matrix_copy_files_results.changed and not matrix_copy_templates_results.changed - become: true \ No newline at end of file diff --git a/roles/n8n/tasks/base.yml b/roles/n8n/tasks/base.yml index 3c3ef93..d4f012e 100644 --- a/roles/n8n/tasks/base.yml +++ b/roles/n8n/tasks/base.yml @@ -14,19 +14,10 @@ - { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' } register: n8n_copy_templates_results -- name: Force update and restart container +- name: Update and restart container community.docker.docker_compose: project_src: n8n state: present pull: true - restarted: true - when: n8n_copy_templates_results.changed + restarted: "{{ n8n_copy_templates_results.changed }}" become: true - -- name: Update or start container - community.docker.docker_compose: - project_src: n8n - state: present - pull: true - when: not n8n_copy_templates_results.changed - become: true \ No newline at end of file diff --git a/roles/protonmail/tasks/base.yml b/roles/protonmail/tasks/base.yml index 4b8fb09..c4114dd 100644 --- a/roles/protonmail/tasks/base.yml +++ b/roles/protonmail/tasks/base.yml @@ -32,19 +32,10 @@ msg: Please run init.sh in protonmail folder and set variable protonmail.initialized to true and restart tasks when: not protonmail.initialized -- name: Force update and restart container +- name: Update and restart container community.docker.docker_compose: project_src: protonmail state: present pull: true - restarted: true - when: protonmail.initialized and (protonmail_copy_templates_results.changed or protonmail_copy_files_results.changed) + restarted: "{{ protonmail.initialized and (protonmail_copy_templates_results.changed or protonmail_copy_files_results.changed) }}" become: true - -- name: Update or start container - community.docker.docker_compose: - project_src: protonmail - state: present - pull: true - when: protonmail.initialized and not protonmail_copy_templates_results.changed and not protonmail_copy_files_results.changed - become: true \ No newline at end of file diff --git a/roles/traefik/tasks/base.yml b/roles/traefik/tasks/base.yml index c332c33..cb13593 100644 --- a/roles/traefik/tasks/base.yml +++ b/roles/traefik/tasks/base.yml @@ -28,19 +28,10 @@ state: present become: true -- name: Force update and restart container +- name: Update and restart container community.docker.docker_compose: project_src: traefik state: present pull: true - restarted: true - when: traefik_copy_files_results.changed or traefik_copy_templates_results.changed - become: true - -- name: Update or start container - community.docker.docker_compose: - project_src: traefik - state: present - pull: true - when: not traefik_copy_files_results.changed and not traefik_copy_templates_results.changed + restarted: "{{ traefik_copy_files_results.changed or traefik_copy_templates_results.changed }}" become: true \ No newline at end of file diff --git a/roles/whoami/tasks/base.yml b/roles/whoami/tasks/base.yml index 468e461..7a4619f 100644 --- a/roles/whoami/tasks/base.yml +++ b/roles/whoami/tasks/base.yml @@ -19,14 +19,5 @@ project_src: whoami state: present pull: true - restarted: true - when: whoami_copy_templates_results.changed + restarted: "{{ whoami_copy_templates_results.changed }}" become: true - -- name: Update or start container - community.docker.docker_compose: - project_src: whoami - state: present - pull: true - when: not whoami_copy_templates_results.changed - become: true \ No newline at end of file