From 30c453e32bbd1cf37d468b27450817051ee26ce2 Mon Sep 17 00:00:00 2001 From: Egon Rijpkema Date: Tue, 19 Sep 2017 17:11:34 +0200 Subject: [PATCH] make a loop for more flexibility. --- roles/rabbitmq/files/rabbitmq.service | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/rabbitmq/files/rabbitmq.service b/roles/rabbitmq/files/rabbitmq.service index 775706c..467a37c 100644 --- a/roles/rabbitmq/files/rabbitmq.service +++ b/roles/rabbitmq/files/rabbitmq.service @@ -10,9 +10,9 @@ ExecStartPre=-/usr/bin/docker kill %n ExecStartPre=-/usr/bin/docker rm %n ExecStartPre=/usr/bin/docker pull rabbitmq:latest ExecStart=/usr/bin/docker run \ - --add-host "{{ hostvars[groups['rabbitmq'][0]]['ansible_hostname'] }}:{{ hostvars[groups['rabbitmq'][0]]['ansible_default_ipv4']['address'] }}" \ - --add-host "{{ hostvars[groups['rabbitmq'][1]]['ansible_hostname'] }}:{{ hostvars[groups['rabbitmq'][1]]['ansible_default_ipv4']['address'] }}" \ - --add-host "{{ hostvars[groups['rabbitmq'][2]]['ansible_hostname'] }}:{{ hostvars[groups['rabbitmq'][2]]['ansible_default_ipv4']['address'] }}" \ +{% for host in groups['rabbitmq'] %} + --add-host "{{ host }}:{{ hostvars[host]['ansible_default_ipv4']['address'] }}" \ +{% endfor %} -p 4369:4369 -p 25679:25679 -p 25672:25672 -p 5671-5672:5671-5672 -p 8080:15672 \ -e "RABBITMQ_DEFAULT_USER=user" -e "RABBITMQ_DEFAULT_PASS={{ secrets['RABBIT_PASSWORD'] }}" \ -e "RABBITMQ_ERLANG_COOKIE={{ secrets['RABBITMQ_ERLANG_COOKIE'] }}" \