aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal (inc0) Jastrzebski <inc007@gmail.com>2016-03-18 16:49:09 +0000
committerMichal (inc0) Jastrzebski <inc007@gmail.com>2016-03-19 04:24:41 +0000
commitd2f828a1346a0dc673c8b40cde84416661b88b86 (patch)
treefdf3d12ac5108fe0987b723444fb5c8e13f07257
parentdb0de9b7af52251ead2ddacf2a7c283691a6d6b2 (diff)
downloadkolla-d2f828a1346a0dc673c8b40cde84416661b88b86.tar.gz
kolla-d2f828a1346a0dc673c8b40cde84416661b88b86.zip
Add check if all the hostnames are resolvable
Rabbitmq can't work with IPs, so we need to make sure that all rabbit cluster hosts can resolve each others hostnames. We should also require that in docs. DocImpact Closes-Bug: #1559158 Change-Id: I2418187138988d21da3dc3624e9cdbda891d4894
-rw-r--r--ansible/roles/rabbitmq/tasks/bootstrap.yml10
1 files changed, 10 insertions, 0 deletions
diff --git a/ansible/roles/rabbitmq/tasks/bootstrap.yml b/ansible/roles/rabbitmq/tasks/bootstrap.yml
index 881d19553..a7d875b10 100644
--- a/ansible/roles/rabbitmq/tasks/bootstrap.yml
+++ b/ansible/roles/rabbitmq/tasks/bootstrap.yml
@@ -1,4 +1,14 @@
---
+- name: Check if all rabbit hostnames are resolvable
+ command: "getent hosts {{ hostvars[item]['ansible_hostname'] }}"
+ changed_when: false
+ register: rabbitmq_hostnames
+ with_items: groups['rabbitmq']
+
+- fail: msg="Hostname has to resolve to IP address of api_interface"
+ with_items: rabbitmq_hostnames.results
+ when: "{% set ip=item.stdout.split(' ')[0] %}'{{ hostvars[item['item']]['ansible_' + hostvars[item['item']]['api_interface']]['ipv4']['address'] }}' != '{{ ip }}'"
+
- name: Creating rabbitmq volume
kolla_docker:
action: "create_volume"