I have an ansible script that I am writing to use meta data from an aws ec2 instance. I want to create and image of a list og servers from my inventory file them launch each one, then perform a function then terminate the instances.I am currently stuck on trying to get the subnet portion of the meta data as I need to perform two commands.
get the mac address
get the subnet
But I am not able to successfully get the subnet id
This is a misunderstanding. Do not run the command with ansible-playbook as
"shell" task on the remote host!
The "command" shall be run from the command-line on controller. The output
will show all facts collected by the module "setup" on the remote host. The
same facts will be collected automatically by a playbook when not disabled by
"gather_facts: false". See https://docs.ansible.com/ansible/latest/modules/setup_module.html#examples
> ansible dev -m setup
Find the variables that fit your purpose. For example