Just as a follow-up to my own question.
ec2.py --list shows the tag I am looking for.
"ec2_tag_sshkey": "7479",
With this knowledge. What would be the best approach to execute
ansible-playbook and pass that value as --private-key=PRIVATE_KEY_FILE ?
Or use that value within the playbook, previously I was using
ec2_remote_facts but that requires knowing how to connect prior to
execution.
- name: Current EC2 Key
debug:
msg: "{{ ec2_remote_facts.instances[0].tags.sshkey }}"
register: previous_key
ignore_errors: yes
Thanks
Zach
On Wednesday, March 22, 2017 at 12:20:04 PM UTC-7, Zachary Buckholz wrote:
>
> Is it possible to use ansible to read / update aws ec2 instance tags
> without actually logging into the remote machines?
>
>
> For example a use-case would be looking up the EC2 Instance Tag that holds
> the value for the current SSH keypair that should be used to connect.
>
>
> Thanks
> Zach
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/e35ad6e1-afb8-409f-81ed-48f4b5974b3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.