From 432176b2bd8c50b1dc1262b574c5dfa45fbd2eeb Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 11 Sep 2025 06:19:39 +0300 Subject: [PATCH 1/4] ansible_module_requires_too_much_perms_just_for_autoscaling_management_so_replacing_with_aws_cli_from_role --- roles/deploy_code/tasks/cleanup.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/roles/deploy_code/tasks/cleanup.yml b/roles/deploy_code/tasks/cleanup.yml index c4e918c0..b5af885f 100644 --- a/roles/deploy_code/tasks/cleanup.yml +++ b/roles/deploy_code/tasks/cleanup.yml @@ -252,13 +252,8 @@ when: task_result.rc != 0 block: - name: Resume all autoscale processes on ASG. - amazon.aws.autoscaling_group: - name: "{{ asg_management.name }}" - region: "{{ asg_management.region }}" - profile: "{{ asg_management.profile | default(omit) }}" - suspend_processes: [] - delegate_to: localhost - run_once: true + ansible.builtin.include_role: + name: asg_management when: - asg_management.name is defined - asg_management.name | length > 0 From 33752492ca503161c00746cf87dab9e7db6b56d3 Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 11 Sep 2025 06:56:52 +0300 Subject: [PATCH 2/4] fix condition --- roles/deploy_code/tasks/cleanup.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/deploy_code/tasks/cleanup.yml b/roles/deploy_code/tasks/cleanup.yml index b5af885f..6806bfcb 100644 --- a/roles/deploy_code/tasks/cleanup.yml +++ b/roles/deploy_code/tasks/cleanup.yml @@ -274,6 +274,7 @@ when: - asg_management.name is defined - asg_management.name | length > 0 + - asg_management.refresh_asg_instances is defined - asg_management.refresh_asg_instances - name: Start any services we stopped if the image re-mounting failed and ASG management is disabled. From fb1b2e03e28da516ebd8925f43c9b0eb9b18f1e1 Mon Sep 17 00:00:00 2001 From: tim Date: Fri, 12 Sep 2025 18:17:41 +0300 Subject: [PATCH 3/4] asg_management_workaround_improve_fix_conditions --- roles/deploy_code/tasks/cleanup.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/deploy_code/tasks/cleanup.yml b/roles/deploy_code/tasks/cleanup.yml index 6806bfcb..486e695c 100644 --- a/roles/deploy_code/tasks/cleanup.yml +++ b/roles/deploy_code/tasks/cleanup.yml @@ -274,7 +274,7 @@ when: - asg_management.name is defined - asg_management.name | length > 0 - - asg_management.refresh_asg_instances is defined + - asg_management.refresh_asg_instances | default(true) - asg_management.refresh_asg_instances - name: Start any services we stopped if the image re-mounting failed and ASG management is disabled. @@ -288,7 +288,7 @@ when: - deploy_code.service_action == "stop" - deploy_code.services | length > 0 - - not asg_management.refresh_asg_instances or asg_management.name is not defined + - asg_management.refresh_asg_instances is not defined or not asg_management.refresh_asg_instances or asg_management.name is not defined # End of the squashFS block. - name: Trigger an infrastructure rebuild. From 767fe86622a95a92f97d7fea419a6c946d094a20 Mon Sep 17 00:00:00 2001 From: tim Date: Fri, 12 Sep 2025 18:24:26 +0300 Subject: [PATCH 4/4] remove extra line --- roles/deploy_code/tasks/cleanup.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/deploy_code/tasks/cleanup.yml b/roles/deploy_code/tasks/cleanup.yml index 486e695c..9f58d43a 100644 --- a/roles/deploy_code/tasks/cleanup.yml +++ b/roles/deploy_code/tasks/cleanup.yml @@ -275,7 +275,6 @@ - asg_management.name is defined - asg_management.name | length > 0 - asg_management.refresh_asg_instances | default(true) - - asg_management.refresh_asg_instances - name: Start any services we stopped if the image re-mounting failed and ASG management is disabled. ansible.builtin.service: