- name: Add new instance to host group
add_host: hostname={{ item.public_ip }} groupname=launched
with_items: ec2.results[0].instances
- name: set inventory_hostname var
add_host: inventory_hostname={{ item.public_dns_name }} groupname=launched
with_items: ec2.results[0].instances
The first one works correctly but i'm getting the following error in the second one:
'name' is a required argument.