The above doesnt work, but if I list out the items with_items: - ip-10-1-65-27.us-west-2.compute.internal - ip-10-1-65-28.us-west-2.compute.internal - ip-10-1-65-37.us-west-2.compute.internal
then it works, but I want it to be dynamic and find all ips matching ``- ip-10-1-*-*.us-west-2.compute.internal
The above doesnt work, but if I list out the items
with_items:
- ip-10-1-65-27.us-west-2.compute.internal
- ip-10-1-65-28.us-west-2.compute.internal
- ip-10-1-65-37.us-west-2.compute.internal
then it works, but I want it to be dynamic and find all ips matching - ip-10-1-*-*.us-west-2.compute.internal
any help please?
Vào 07:01:51 UTC+7 Thứ Sáu, ngày 02 tháng 2 năm 2018, Andrew Morgan đã viết:
Hello all,
I have a play I want to run wich deletes all hosts matching a certain criteria:
The above doesnt work, but if I list out the items
with_items:
- ip-10-1-65-27.us-west-2.compute.internal
- ip-10-1-65-28.us-west-2.compute.internal
- ip-10-1-65-37.us-west-2.compute.internal
then it works, but I want it to be dynamic and find all ips matching - ip-10-1-*-*.us-west-2.compute.internal
any help please?
Vào 07:01:51 UTC+7 Thứ Sáu, ngày 02 tháng 2 năm 2018, Andrew Morgan đã viết:
with_items requires a list to iterate over. I think one way of achieving your outcome is to create a group in the inventory and populate it with the hosts and run the playbook against that group.
Thanks for your reply, but the issue with that is , the servers in aws get removed and created again each build( every 1hr) , so I would need a way to get the servers dynamically.Is there anyway to do that? i want to dynamically have a list, not create a list of servers in inventory.