Skip to content

Commit de0a5f5

Browse files
fix output
Signed-off-by: Mariusz Jóźwiak <[email protected]>
1 parent 149a79e commit de0a5f5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

site.maintenance.find-untagged.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
- hosts: localhost
22
connection: local
33
vars:
4-
_ec2_whitelist:
5-
- "i-07c245fc7984e0927"
64
_ec2_filters:
75
- "running"
86
- "stopped"
7+
- "pending"
8+
- "shutting-down"
9+
- "stopping"
910
_ec2_ebs_list_review: []
1011
_ec2_untagged_list: []
1112
roles:
@@ -30,7 +31,7 @@
3031
- name: Generate list EC2 to review
3132
set_fact:
3233
_ec2_untagged_list: "{{ _ec2_untagged_list + [{ 'id' : item.instance_id, 'name' : item.tags.Name }] }}"
33-
when: item.instance_id not in _ec2_whitelist
34+
when: item.instance_id not in aws_ec2_whitelist
3435
with_items: "{{ _ec2_list_all.instances | difference(_ec2_list_mageops.instances) }}"
3536

3637
- name: Find unused EBS volumes
@@ -51,9 +52,10 @@
5152

5253
- name: Set _ec2_list_review
5354
set_fact:
54-
_ec2_list_review: "{{ _ec2_list_review | default() + 'ID : ' + item.id {% if item.name is definied %} + ' Name : ' + item.name + {% endif %} '\n' }}"
55+
_ec2_list_review: "{{ _ec2_list_review | default() + 'ID : ' + item.id + ' Name : ' + item.name | default() '\n' }}"
5556
with_items: "{{ _ec2_untagged_list }}"
5657

58+
5759
- name: Failed when some resources found
5860
fail:
5961
msg: "{% if (_ec2_ebs_list.volumes | length) > 0 %} EBS volumes to review: {{ _ec2_ebs_list_review | join(',') }} \n {% endif %} \

0 commit comments

Comments
 (0)