The challenge isn't finding facts about the current server the playbook is 
running on. It's using facts about another server in the current playbook. 
I've already collected the facts I need - I just need to know how to access 
facts from another server for use on the current server.

On Tuesday, June 21, 2016 at 6:56:28 AM UTC-4, Matthew Kettlewell wrote:
>
> Would ec2_facts or ec2_remote_facts do what you're looking for?
>
> http://docs.ansible.com/ansible/ec2_remote_facts_module.html
> http://docs.ansible.com/ansible/ec2_facts_module.html
>
>
>
> On Monday, June 20, 2016 at 2:04:53 PM UTC-5, Anthony Sheetz wrote:
>>
>> I need to access information discovered from another server for a 
>> template on the server I'm configuring.
>>
>> We are using AWS, and I'm of course using ec2.py to discover my hosts. I 
>> first configure a utility server, and then configure my web servers. I tag 
>> the utility server with an appropriate Name, and then in my web server 
>> configuration playbook I include a bit to discover facts about the utility 
>> server using appropriate tags. How do I then reference the facts about the 
>> utility server in the templates for the web server?
>>
>> If I dump hostvars, I can see the information I want does exist, I just 
>> can't convince Google to show me an example to follow.
>>
>> Here's an example playbook which DOES NOT work, but does illustrate the 
>> context:
>>
>> ---
>>>
>>> # Called like: ansible-playbook -i ./ec2.py --extra-vars "chaos=test" 
>>>> aws_playground.yaml
>>>
>>> - name: Collect our facts on bc-util
>>>
>>>   hosts: "tag_Name_{{ chaos }}_bc_util"
>>>
>>>   tasks:
>>>
>>>   - debug: var=ansible_all_ipv4_addresses
>>>
>>>  
>>
>>> - name: Set up a bc-web server
>>>
>>>   hosts: "tag_Name_{{ chaos }}_bc_web"
>>>
>>>   become: yes
>>>
>>>   become_user: root
>>>
>>>   remote_user: admin
>>>
>>>   tasks:
>>>
>>>   - debug: msg="{{ hostvars }}"
>>>
>>>

-- 
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/a8c77ef1-c804-4b1a-8cef-bd6528b5572c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to