File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 - " stopping"
1010 _ec2_ebs_list_review : []
1111 _ec2_untagged_list : []
12+ _ec2_list_to_review :
1213 roles :
1314 - role : cs.aws-rds-facts
1415 tasks :
3031
3132 - name : Generate list EC2 to review
3233 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('') }] }}"
3435 when : item.instance_id not in aws_ec2_whitelist
3536 with_items : " {{ _ec2_list_all.instances | difference(_ec2_list_mageops.instances) }}"
3637
4647 _ec2_ebs_list_review : " {{ _ec2_ebs_list_review + [item.id] }}"
4748 with_items : " {{ _ec2_ebs_list.volumes }}"
4849
49- - name : Set _ec2_list_review
50+ - name : debug
51+ debug :
52+ var : _ec2_untagged_list
53+
54+ - name : Generate string to end output
5055 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 }}"
5257 with_items : " {{ _ec2_untagged_list }}"
5358
54-
5559 - name : Failed when some resources found
5660 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 %}
5964 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