--- - name: Add rabbitmq cluster hosts lineinfile: dest: /etc/hosts line: "{{ hostvars[item].rabbitmq_cluster_ip_address | default(hostvars[item].ansible_default_ipv4.address) }} {{ hostvars[item].ansible_hostname }}" with_items: "{{ ansible_play_hosts }}" - name: Set erlang cookie template: src: erlang.cookie.j2 dest: "{{ rabbitmq_erlang_cookie_file }}" owner: rabbitmq group: rabbitmq mode: 0400