From 4221a6d46039a8e2a77231b544af755aba85c3c9 Mon Sep 17 00:00:00 2001 From: Ivo Branco Date: Wed, 22 Mar 2023 21:38:51 +0000 Subject: [PATCH] Change: no longer force recreate on compose deploy --- README.md | 7 +++++-- tasks/docker_deploy_shell.yml | 17 +++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 885691f..dc14dce 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,11 @@ So if you need to use the docker-compose syntax > 2.0, you need to assign `true` * `docker_deploy_shell_start_default` - by default uses the command `docker-compose pull && docker-compose build && docker-compose up -d` that pull's, build's and -startup the compose. By default a `--force-recreate` parameter is added if any file, template or git -repository has changed. You can replace that additional parameter if you override the +startup the compose. +If you want to `--force-recreate` if any file, template or git +repository has changed. You can should add `--force-recreate` to the +`docker_deploy_shell_start_default_additional_parameters_if_changed` ansible variable. +If you want to always add parameters to the docker-compose command you should use the `docker_deploy_shell_start_default_additional_parameters` ansible variable. * `docker_deploy_force_restart` - to forcefully restart / recreate the containers diff --git a/tasks/docker_deploy_shell.yml b/tasks/docker_deploy_shell.yml index 4b568b6..1c4b399 100644 --- a/tasks/docker_deploy_shell.yml +++ b/tasks/docker_deploy_shell.yml @@ -23,14 +23,15 @@ shell: "{{ docker_deploy_shell_start if docker_deploy_shell_start is defined else ( docker_deploy_shell_start_default if docker_deploy_shell_start_default is defined else ( 'docker-compose pull && docker-compose build && docker-compose up -d ' + - (docker_deploy_shell_start_default_additional_parameters | default ( - '--force-recreate' - if (docker_deploy_force_restart | default(false)) or - (docker_compose_template_out is defined and docker_compose_template_out.changed) or - docker_deploy_files_out.changed or - docker_deploy_templates_out.changed or - docker_deploy_git_repositories_out.changed - else '' + (docker_deploy_shell_start_default_additional_parameters | + default ( + (docker_deploy_shell_start_default_additional_parameters_if_changed | default('')) + if (docker_deploy_force_restart | default(false)) or + (docker_compose_template_out is defined and docker_compose_template_out.changed) or + docker_deploy_files_out.changed or + docker_deploy_templates_out.changed or + docker_deploy_git_repositories_out.changed + else '' ) ) )