The flow is:

provision.yml:
------------------
- name: Provision rabbitmq cluster
  hosts: localhost
  connection: local
  gather_facts: yes
  tags: [provision, rabbitmq_cluster]

  tasks:
    - name: Create rabbitmq-server instance
      ec2:
        ...

- include: ../../configure/rabbitmq-server.yml
  tags: [configure, rabbitmq_cluster]



rabbitmq-server.yml
---------------------------
- name: Configure rabbitmq-server (install and configure)
  hosts: rabbitmq_server
  sudo: yes
  gather_facts: true
  tags: [rabbitmq_server]

  pre_tasks:
    - debug: var=hostvars[item]
      with_items: groups.rabbitmq_server

    - name: Update /etc/hosts with rabbitmq-server hostnames
      lineinfile:
        dest: /etc/hosts
        regexp: "^{{hostvars[item]['ansible_default_ipv4']['address']}} 
{{hostvars[item]['ansible_hostname']}}$"
        line: "{{hostvars[item]['ansible_default_ipv4']['address']}} 
{{hostvars[item]['ansible_hostname']}}"
        state: present
      with_items: groups.rabbitmq_server

>
>

-- 
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/a63ea6dc-cbca-4e46-94c2-5f80dddadfda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to