Created
June 30, 2021 21:16
-
-
Save nleiva/08af163a6e87d0b29251c731cdd2a0a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Add instance(s) to my_instances group | |
ansible.builtin.add_host: | |
name: "{{ item.tags.Name }}" | |
ansible_host: "{{ item.public_ip_address }}" | |
ansible_user: "{{ ec2_username }}" | |
private_ip: "{{ item.private_ip_address }}" | |
instance_name: "{{ ec2_resource_prefix }}" | |
ansible_ssh_private_key_file: "{{ playbook_dir }}/{{ ec2_resource_prefix }}-private.pem" | |
instance_ssh: "{{ ssh_info }}" | |
groups: | |
- my_instances | |
with_items: "{{ ansible_node_facts.instances }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment