File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 9
9
- " stopping"
10
10
_ec2_ebs_list_review : []
11
11
_ec2_untagged_list : []
12
+ _ec2_list_to_review :
12
13
roles :
13
14
- role : cs.aws-rds-facts
14
15
tasks :
30
31
31
32
- name : Generate list EC2 to review
32
33
set_fact :
33
- _ec2_untagged_list : " {{ _ec2_untagged_list + [{ 'id' : item.instance_id, 'name' : item.tags.Name }] }}"
34
+ _ec2_untagged_list : " {{ _ec2_untagged_list + [{ 'id' : item.instance_id, 'name' : item.tags.Name | default('') }] }}"
34
35
when : item.instance_id not in aws_ec2_whitelist
35
36
with_items : " {{ _ec2_list_all.instances | difference(_ec2_list_mageops.instances) }}"
36
37
46
47
_ec2_ebs_list_review : " {{ _ec2_ebs_list_review + [item.id] }}"
47
48
with_items : " {{ _ec2_ebs_list.volumes }}"
48
49
49
- - name : Set _ec2_list_review
50
+ - name : debug
51
+ debug :
52
+ var : _ec2_untagged_list
53
+
54
+ - name : Generate string to end output
50
55
set_fact :
51
- _ec2_list_review : " {{ _ec2_list_review | default() + ' ID : ' + item.id + ' Name : ' + item.name | default() ' \n ' }}"
56
+ _ec2_list_to_review : " {{ (_ec2_list_to_review) }} ID : {{ item.id }} Name : {{ item.name }}"
52
57
with_items : " {{ _ec2_untagged_list }}"
53
58
54
-
55
59
- name : Failed when some resources found
56
60
fail :
57
- msg : " {% if (_ec2_ebs_list.volumes | length) > 0 %} EBS volumes to review: {{ _ec2_ebs_list_review | join(',') }} \n {% endif %} \
58
- {% if (_ec2_untagged_list | length) > 0 %} EC2 instances to review: \n {{ _ec2_list_review }} {% endif %} "
61
+ msg : |
62
+ {% if (_ec2_ebs_list.volumes | length) > 0 %} EBS volumes to review: {{ _ec2_ebs_list_to_review | join(',') }} {% endif %}
63
+ {% if (_ec2_untagged_list | length) > 0 %} EC2 instances to review: \n {{ _ec2_list_to_review }} {% endif %}
59
64
when : " {{ (_ec2_untagged_list | length > 0) or (_ec2_ebs_list.volumes | length >0) }}"
You can’t perform that action at this time.
0 commit comments