Have you read http://docs.ansible.com/guide_rax.html ?
On Fri, May 30, 2014 at 9:07 AM, Marcin Prączko <[email protected]> wrote: > Hello. > > I would like to ask for hint related with following challange. > - Gather details about hosts (external IP for example) from > RackSpace-Cloud with RAX_modules > - Generate configuration for monitoring server related with RS-images. > > So I have following setup: > - Remote VMs in RackSpace (RS) Cloud - which are behind NAT - so ansible > facts gather internal IP > - Remote VM with monitoring system > - Local VM for running ansible. > > I've manged to do: > - Gather facts from RS-Cloud VMs - for example partiions, etc > - Gather external IP from RS with RAX modules. > > *Challnage:* > How to force run delegate_to on monitoring system to generate correct > nagios configuation with valid external VM per host. > > *Following Ansible documenation I have following playbook:* > # Gather details about RS > - name: RS-Cloud-VMs | Gather info about servers > hosts: www > connection: local > gather_facts: False > > tasks: > - { include: roles/rax/tasks/gather_info_about_nodes.yml, > rax_credentials: 'files/rax/terr01.cfg', rax_region: DFW } > - include: roles/monitoring-server/tasks/generate_nagios_hostcfg.yml > > > *And task to generate nagios hostcfg looks:* > - name: Monitoring-Server | Generate main host files for node > template: src={{ item }}.j2 dest=/path/to/file/{{ item }}-{{ > ansible_fqdn }}.cfg > owner=ssh_login group=users mode=0644 > delegate_to: monitoring > with_items: > - host > > > As you can see connection for Playbook is 'local' as recommended on your > documentation, task is doing delegate_to remote monitoring host, however > ansible is connecting with local host (forced by connection: local). > > Could you let me know what is a best practice to achieve this, please? > Especially that: > - Some VMs (in RS cloud) are behind NAT so ansible is able only gather > internal IP > - Have to use rax module to get info about RS VMs with external IP. > > The only one solution which comes to me is now: > - Generate required files locally > - Use rsync module later on monitoring system. > > Not quite happy with this solution, but maybe will be the fastests. > > Best regards, > Marcin Praczko > > -- > 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/52c9f995-bedc-4b40-9bbc-86ad0cdad116%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/52c9f995-bedc-4b40-9bbc-86ad0cdad116%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CA%2BnsWgxciYGYkWoRa4T%3DH%2BgGbLZTHZMvaYLkzDCr%3DhmC3iZ5bg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
