Last active
June 13, 2018 03:39
-
-
Save naavveenn/f93004c1d06919ff2a87d6ba9592c7ae 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
--- | |
- hosts: local | |
connection: local | |
gather_facts: yes | |
vars: | |
aws_region: ap-south-1 | |
aws_access_key: asfhafsfaadvadvdv | |
aws_secret_key: KVsfioefln845141cashcgaksjsdvsdv | |
tasks: | |
- name: get instance id | |
ec2_instance_facts: | |
region: "{{ aws_region }}" | |
access_key: "{{ aws_access_key }}" | |
secret_key: "{{ aws_secret_key }}" | |
# filters: #based on tags | |
# "tag:Owner": Naveen | |
# instance-state-name: running #will only filter based on running instances | |
register: ec2 | |
- debug: | |
msg: "The instance id is '{{ item.instance_id }}'" | |
with_items: | |
- "{{ ec2.instances }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment