5
5
+ aws_asg_instance_refresh_cli_args_base
6
6
+ [ '--cli-input-json', aws_asg_instance_refresh_params | to_json ] }}
7
7
vars :
8
- aws_asg_instance_refresh_params :
9
- AutoScalingGroupName : " {{ autoscaling_asg_name }}"
10
- # Note: A futureproof setting - there is no other strategy as of yet.
11
- Strategy : Rolling
12
- Preferences :
13
- MinHealthyPercentage : " {{ autoscaling_rolling_instance_refresh_min_healthy_percent }}"
14
- InstanceWarmup : " {{ autoscaling_rolling_instance_refresh_extra_warmup_grace_period }}"
8
+ # This is rendered in template string directly on purpose
9
+ # as otherwise ansible will pass numbers as string causing API error.
10
+ aws_asg_instance_refresh_params : >-
11
+ {{
12
+ {
13
+ "AutoScalingGroupName": autoscaling_asg_name,
14
+ "Strategy": "Rolling",
15
+ "Preferences": {
16
+ "MinHealthyPercentage": autoscaling_rolling_instance_refresh_min_healthy_percent | int,
17
+ "InstanceWarmup": autoscaling_rolling_instance_refresh_extra_warmup_grace_period | int
18
+ }
19
+ }
20
+ }}
15
21
register : aws_asg_instance_refresh_command
16
22
17
23
- name : Compute instance refresh task info
20
26
aws_asg_instance_refresh_estimated_duration : >-
21
27
{{ ( ( autoscaling_healthcheck_grace_period | int
22
28
+ autoscaling_rolling_instance_refresh_extra_warmup_grace_period | int )
23
- * autoscaling_asg_desired_capacity | int
29
+ * autoscaling_asg_desired_capacity | int
24
30
* ( autoscaling_rolling_instance_refresh_min_healthy_percent | int + 100 )
25
31
/ 100 ) | round(1, 'ceil') }}
26
32
54
60
"- \(.PercentageComplete)% complete", "/ \(.InstancesToUpdate) left",
55
61
( if .StatusReason then "(\(.StatusReason))" else "" end ) ] | join(" "))'; \
56
62
done
57
-
63
+
58
64
========================================================
59
65
60
66
- name : Wait for the rolling Instance Refresh to complete
67
73
aws_asg_instance_describe_refresh_params :
68
74
AutoScalingGroupName : " {{ autoscaling_asg_name }}"
69
75
InstanceRefreshIds : [ "{{ aws_asg_instance_refresh_id }}" ]
70
- aws_asg_instance_describe_data : >-
71
- {{ ( aws_asg_describe_instance_refresh_command.stdout
72
- | default('{"Status": null, "PercentageComplete": -1}')
76
+ aws_asg_instance_describe_data : >-
77
+ {{ ( aws_asg_describe_instance_refresh_command.stdout
78
+ | default('{"Status": null, "PercentageComplete": -1}')
73
79
| from_json ).InstanceRefreshes | first }}
74
80
register : aws_asg_describe_instance_refresh_command
75
81
until : >-
76
- aws_asg_describe_instance_refresh_command is not failed
82
+ aws_asg_describe_instance_refresh_command is not failed
77
83
and aws_asg_instance_describe_data.PercentageComplete | default(0, true) | int == 100
78
84
and aws_asg_instance_describe_data.Status == 'Successful'
79
85
delay : " {{ aws_asg_instance_refresh_progress_check_interval }}"
80
- retries : >-
81
- {{ ( aws_asg_instance_refresh_progress_check_timeout | int
82
- / aws_asg_instance_refresh_progress_check_interval | int ) | int }}
86
+ retries : >-
87
+ {{ ( aws_asg_instance_refresh_progress_check_timeout | int
88
+ / aws_asg_instance_refresh_progress_check_interval | int ) | int }}
0 commit comments