From a9a3d24a3dc70c93577a71fe129e87fe2c8ac4b2 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 6 Jul 2017 13:33:49 -0500 Subject: [PATCH 1/3] ceph-common: fixes bug related to monitor_interface set in inventory The ceph.conf template needs to look for the value of monitor_interface in hostvars[host] because there might be different values set per host. Signed-off-by: Andrew Schoen --- roles/ceph-common/templates/ceph.conf.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/ceph-common/templates/ceph.conf.j2 b/roles/ceph-common/templates/ceph.conf.j2 index eec6029c3..34b1a8d4f 100644 --- a/roles/ceph-common/templates/ceph.conf.j2 +++ b/roles/ceph-common/templates/ceph.conf.j2 @@ -46,9 +46,9 @@ mon host = {% for host in groups[mon_group_name] -%} {%- endif %} {%- else -%} {% if ip_version == 'ipv4' -%} - {{ hostvars[host]['ansible_' + monitor_interface][ip_version]['address'] }} + {{ hostvars[host]['ansible_' + hostvars[host]['monitor_interface']][ip_version]['address'] }} {%- elif ip_version == 'ipv6' -%} - [{{ hostvars[host]['ansible_' + monitor_interface][ip_version][0]['address'] }}] + [{{ hostvars[host]['ansible_' + hostvars[host]['monitor_interface']][ip_version][0]['address'] }}] {%- endif %} {%- endif %} {% if not loop.last -%},{%- endif %} From 7029be70faa76d6fec70fb0851b5f8be613202be Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 6 Jul 2017 13:36:54 -0500 Subject: [PATCH 2/3] tests: remove monitor_interface from centos/7/cluster/group_vars/all This is to ensure that the template must use the values set in the inventory. Signed-off-by: Andrew Schoen --- tests/functional/centos/7/cluster/group_vars/all | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/functional/centos/7/cluster/group_vars/all b/tests/functional/centos/7/cluster/group_vars/all index 9f7313efd..d3b914530 100644 --- a/tests/functional/centos/7/cluster/group_vars/all +++ b/tests/functional/centos/7/cluster/group_vars/all @@ -4,7 +4,6 @@ ceph_stable: True cluster: test public_network: "192.168.1.0/24" cluster_network: "192.168.2.0/24" -monitor_interface: eth1 journal_size: 100 osd_objectstore: "filestore" devices: From 4e87c1f0f503c29fef734cf486047e9813dd96cf Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 6 Jul 2017 13:59:17 -0500 Subject: [PATCH 3/3] ceph-common: make sure monitor_interface or monitor_address is defined Signed-off-by: Andrew Schoen --- roles/ceph-common/tasks/checks/check_mandatory_vars.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/ceph-common/tasks/checks/check_mandatory_vars.yml b/roles/ceph-common/tasks/checks/check_mandatory_vars.yml index 9565383b4..c202d4404 100644 --- a/roles/ceph-common/tasks/checks/check_mandatory_vars.yml +++ b/roles/ceph-common/tasks/checks/check_mandatory_vars.yml @@ -33,8 +33,10 @@ tags: - package-install -- name: make sure monitor_interface is defined +- name: make sure monitor_interface or monitor_address is defined fail: - msg: "you must set monitor_interface" + msg: "you must set monitor_interface or monitor_address" when: - monitor_interface == 'interface' + - monitor_address == "0.0.0.0" + - mon_group_name in group_names