Last active
May 25, 2016 15:11
-
-
Save pporada-gl/ea5eb497dc33ab39225320f00a38b3a0 to your computer and use it in GitHub Desktop.
This file contains 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: localhost | |
connection: local | |
tasks: | |
- ec2_remote_facts: | |
region: us-east-1 | |
filters: | |
instance-state-name: running | |
"tag:ENV": prod | |
"tag:ROLES": consul-server | |
register: ec2_facts | |
- set_fact: | |
consul_servers: "{{ec2_facts.instances | map(attribute='private_ip_address') | list | join(',') }}" | |
- debug: | |
msg: "{{consul_servers}}" | |
# Example output | |
# 192.168.1.1,192.168.1.2,192.168.1.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ec2.py can't yet AND filters.
Ec2_remote_facts by default will AND.