I have been trying to create a playbook that removes the resource record sets for terminated EC2 instances.
Other tasks can debug fine, but when it comes to intersect and difference to debug/list the common contents to keep and non-common to be removed, the output still brings the entire list of resource record sets. If anyone can help, I would really appreciate it.
-
name: running Instances
debug:
msg: “{{item.0 | intersect(item.1)}}”
with_items: -
“{{record_sets |json_query(‘ResourceRecordSets.Name’)}}”
-
“{{running_ec2 |json_query(‘instances.tags.erp_url’)}}”
-
name: terminated Instances
debug:
msg: “{{item.0 | difference(item.1)}}”
with_items: -
“{{record_sets |json_query(‘ResourceRecordSets.Name’)}}”
-
“{{running_ec2 |json_query(‘instances.tags.erp_url’)}}”