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/d2999d1e-46e4-4c74-8c0b-0d5ace023a17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.