File tree 11 files changed +42
-46
lines changed
11 files changed +42
-46
lines changed Original file line number Diff line number Diff line change 1
- # highest version provisioning runs fully on
2
- ansible>=2.7,<2.8
1
+ # DO NOT upgrade to >=2.9.3 until
2
+ # https://github.com/ansible/ansible/issues/66641
3
+ ansible==2.9.2
3
4
4
5
# needed for inventory and aws modules
5
6
boto3
@@ -21,4 +22,4 @@ docker-py
21
22
awscli
22
23
23
24
# required for awscli
24
- PyYAML<5.3
25
+ PyYAML<5.3
Original file line number Diff line number Diff line change 15
15
register : ami_output
16
16
17
17
- name : Wait until AMI is accessible
18
- ec2_ami_find :
18
+ ec2_ami_info :
19
19
region : " {{ aws_region }}"
20
20
owner : self
21
- sort : creationDate
22
- sort_order : descending
23
- no_result_action : fail
24
- ami_tags : " {{ aws_tags_base | combine(ami_tags) }}"
25
- register : ami_found
26
- until : ami_found.results is defined and ami_found.results[0].ami_id == ami_output.image_id and ami_found.results[0].state == "available"
21
+ filters : " {{ aws_tags_base | prefix_keys('tag:') | combine(ami_facts_tag_filters) }}"
22
+ vars :
23
+ ami_facts_tag_filters : " {{ ami_tags | prefix_keys('tag:') }}"
24
+ register : ami_facts
25
+ until : " ami_facts.images is defined and ami_facts.images|length > 0"
27
26
retries : 60
28
27
delay : 5
29
28
when : ami_output is changed
30
-
Original file line number Diff line number Diff line change
1
+ dependencies :
2
+ - role : cs.ansible-plugins
Original file line number Diff line number Diff line change 32
32
msg : " Keeping {{ _aws_ec2_cleanup_ami_ids_to_keep | count }} AMIs: {{ _aws_ec2_cleanup_ami_ids_to_keep | join(', ') }}"
33
33
34
34
- name : Get list of App AMIs
35
- ec2_ami_find :
35
+ ec2_ami_info :
36
36
region : " {{ aws_region }}"
37
37
owner : self
38
- sort : creationDate
39
- sort_order : descending
40
- ami_tags :
41
- " Role " : " app"
42
- " Project " : " {{ mageops_project }}"
43
- " Environment " : " {{ mageops_environment }}"
38
+ filters : " {{ aws_tags_base | prefix_keys('tag:') | combine(aws_tags_role_app_filter) }}"
39
+ vars :
40
+ aws_tags_role_app_filter : " {{ aws_tags_role_app | prefix_keys('tag:') }}"
44
41
register : _aws_ec2_cleanup_env_amis
45
42
46
43
- name : " Remove Launch Configurations not longer required"
56
53
region : " {{ aws_region }}"
57
54
state : absent
58
55
delete_snapshot : yes
59
- image_id : " {{ item.ami_id }}"
60
- with_items : " {{ _aws_ec2_cleanup_env_amis.results }}"
56
+ image_id : " {{ item.image_id }}"
57
+ with_items : " {{ _aws_ec2_cleanup_env_amis.images }}"
61
58
when :
62
- - not item | skipped
63
- - item.ami_id not in _aws_ec2_cleanup_ami_ids_to_keep
64
-
59
+ - item is not skipped
60
+ - item.image_id not in _aws_ec2_cleanup_ami_ids_to_keep
Original file line number Diff line number Diff line change 1
1
- name : Get EC2 instance information for nodes
2
- ec2_instance_facts :
2
+ ec2_instance_info :
3
3
region : " {{ aws_region }}"
4
4
filters : " {{ aws_node_facts_base_filters | combine(aws_node_facts_base_tags | combine(node.tags) | prefix_keys('tag:')) }}"
5
5
loop :
72
72
set_fact :
73
73
mageops_redis_sessions_host : " {{ aws_nodes_info.redis.private_ip_address }}"
74
74
when : not mageops_redis_sessions_host | default(false, true) and aws_nodes_info.redis
75
-
Original file line number Diff line number Diff line change 1
1
- name : Find EC2 instances to be processed
2
- ec2_instance_facts :
2
+ ec2_instance_info :
3
3
region : " {{ aws_region }}"
4
4
filters : " {{ node_state_instance_filters | combine(node_state_instance_tags | prefix_keys('tag:')) }}"
5
- register : node_state_ec2_instance_facts
5
+ register : node_state_ec2_instance_info
6
6
7
7
- name : Enforce target state instances found
8
8
ec2 :
9
9
region : " {{ aws_region }}"
10
10
state : " {{ node_state_target }}"
11
- instance_ids : " {{ node_state_ec2_instance_facts .instances | map(attribute='instance_id') | list }}"
11
+ instance_ids : " {{ node_state_ec2_instance_info .instances | map(attribute='instance_id') | list }}"
12
12
wait : yes
13
- when : node_state_ec2_instance_facts .instances | length > 0
13
+ when : node_state_ec2_instance_info .instances | length > 0
Original file line number Diff line number Diff line change 3
3
- name : Get VPC IP addresses of backend app instances
4
4
delegate_to : localhost
5
5
become : no
6
- ec2_instance_facts :
6
+ ec2_instance_info :
7
7
region : " {{ aws_region }}"
8
8
filters : " {{ varnish_backend_instances_filter_base | combine(varnish_backend_instances_aws_tags | prefix_keys('tag:')) }}"
9
- register : _varnish_backends_ec2_instance_facts
9
+ register : _varnish_backends_ec2_instance_info
10
10
11
11
- name : Set Varnish backend instances if any are running (AWS)
12
12
set_fact :
13
- varnish_backend_instances_app : " {{ _varnish_backends_ec2_instance_facts .instances }}"
14
- when : _varnish_backends_ec2_instance_facts .instances | length > 0
13
+ varnish_backend_instances_app : " {{ _varnish_backends_ec2_instance_info .instances }}"
14
+ when : _varnish_backends_ec2_instance_info .instances | length > 0
15
15
when : varnish_standalone and aws_use
16
16
17
17
- name : Check if throttling shall be enabled
18
18
set_fact :
19
- varnish_throttling_enabled : " {{ (varnish_standalone and varnish_throttling and varnish_throttling_rules | length > 0)|bool }}"
19
+ varnish_throttling_enabled : " {{ (varnish_standalone and varnish_throttling and varnish_throttling_rules | length > 0)|bool }}"
Original file line number Diff line number Diff line change 37
37
- name : Remove other EC2 Servers
38
38
block :
39
39
- name : Get list of EC2 instances
40
- ec2_instance_facts :
40
+ ec2_instance_info :
41
41
region : " {{ aws_region }}"
42
42
filters :
43
43
" vpc-id " : " {{ _aws_vpc_id }}"
Original file line number Diff line number Diff line change 10
10
when : start_ec2
11
11
block :
12
12
- name : Get list of EC2 instances
13
- ec2_instance_facts :
13
+ ec2_instance_info :
14
14
region : " {{ aws_region }}"
15
15
filters :
16
16
" vpc-id " : " {{ aws_vpc_id }}"
17
- register : start_ec2_instance_facts
17
+ register : start_ec2_instance_info
18
18
19
19
- name : Start instances
20
20
ec2 :
24
24
wait_timeout : 600
25
25
wait : yes
26
26
vars :
27
- start_ec2_instance_ids : " {{ start_ec2_instance_facts | json_query('instances[].instance_id') }}"
27
+ start_ec2_instance_ids : " {{ start_ec2_instance_info | json_query('instances[].instance_id') }}"
28
28
29
29
- name : Scale up App Node ASGs
30
30
when : start_asg
48
48
with_items : " {{ start_asgs }}"
49
49
vars :
50
50
start_asgs : " {{ start_asg_facts | json_query('results[].{ name: auto_scaling_group_name, lc: launch_configuration_name}') }}"
51
-
51
+
52
52
- name : Scale up Extra App Node ASGs
53
53
when : start_asg and (aws_extra_app_asg_enable or magento_aws_ondemand_import_instance_enable)
54
54
block :
70
70
wait_timeout : 600
71
71
with_items : " {{ start_asgs }}"
72
72
vars :
73
- start_asgs : " {{ start_asg_facts | json_query('results[].{ name: auto_scaling_group_name, lc: launch_configuration_name}') }}"
73
+ start_asgs : " {{ start_asg_facts | json_query('results[].{ name: auto_scaling_group_name, lc: launch_configuration_name}') }}"
74
74
75
75
vars :
76
76
start : yes
Original file line number Diff line number Diff line change 27
27
with_items : " {{ stop_asgs }}"
28
28
vars :
29
29
stop_asgs : " {{ stop_asg_facts | json_query('results[].{ name: auto_scaling_group_name, lc: launch_configuration_name}') }}"
30
-
30
+
31
31
- name : Stop standalone EC2 instances
32
32
when : stop_ec2
33
33
block :
34
34
- name : Get list of EC2 instances
35
- ec2_instance_facts :
35
+ ec2_instance_info :
36
36
region : " {{ aws_region }}"
37
37
filters :
38
38
" vpc-id " : " {{ aws_vpc_id }}"
39
- register : stop_ec2_instance_facts
39
+ register : stop_ec2_instance_info
40
40
41
41
- name : Stop instances
42
42
ec2 :
45
45
state : stopped
46
46
wait : no
47
47
vars :
48
- stop_ec2_instance_ids : " {{ stop_ec2_instance_facts | json_query('instances[].instance_id') }}"
48
+ stop_ec2_instance_ids : " {{ stop_ec2_instance_info | json_query('instances[].instance_id') }}"
49
49
vars :
50
50
stop : yes
51
51
stop_ec2 : " {{ stop }}"
Original file line number Diff line number Diff line change 3
3
become : no
4
4
tasks :
5
5
- name : Get list of EC2 instances
6
- ec2_instance_facts :
6
+ ec2_instance_info :
7
7
region : " {{ aws_region }}"
8
8
filters :
9
9
" tag:Role " : " app"
56
56
- vars/aws/env.yml
57
57
vars :
58
58
blackfire_urls :
59
- - " {{ magento_base_url }}"
59
+ - " {{ magento_base_url }}"
You can’t perform that action at this time.
0 commit comments