Created
August 26, 2015 20:35
-
-
Save alloy-d/5ff64d908ad092b086e4 to your computer and use it in GitHub Desktop.
Experimenting with getting a specific host's IP in Ansible
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: "debug hosts" | |
hosts: "tag_ov_env_future" | |
tasks: | |
- name: "what is play_hosts?" | |
debug: var=play_hosts | |
# - name: "what are the variables for these hosts?" | |
# debug: "var=hostvars[item]['ec2_dns_name']" | |
# with_items: play_hosts | |
# when: hostvars[item]["ec2_tag_role"] == "media-queue" | |
- name: "let's find the media queue's IP" | |
local_action: | |
module: set_fact | |
media_queue_host: "{{ hostvars[item]['ec2_dns_name'] }}" | |
with_items: play_hosts | |
when: hostvars[item]["ec2_tag_role"] == "media-queue" | |
- name: "let's figure out if we figured it out" | |
local_action: | |
module: debug | |
var: media_queue_host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment