From 0e159398de252a0d2bcae42888e05c16bb08ad93 Mon Sep 17 00:00:00 2001 From: John Fulton Date: Mon, 18 Jan 2021 15:40:18 +0000 Subject: [PATCH] Make get ceph_mon_ip addresses task composable network compatible Do not assume we will always have hostvars[]['storage_ip']. Instead use the service_net_map, found in global_vars.yaml of config-download. Within this directory, if ceph_mon on the list tripleo_enabled_services, then there will be a service_net_map containing the ceph_mon_network. As per tripleo_common/inventory.py, this network name, whatever it is composed to, will have an '_ip' appended to it which will map to the correct IP address. Without network isolation ceph_mon_network will default to ctlplane. With network isolation it will default to storage, but it could also be composed to anything, so we can use this method to pick up whatever it is. Closes-Bug: #1912218 Change-Id: I7c1052b1c27ea91c5f97f59ec80c906d60d5f13e --- .../roles/tripleo_ceph_client/tasks/ceph_ansible.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tripleo_ansible/roles/tripleo_ceph_client/tasks/ceph_ansible.yml b/tripleo_ansible/roles/tripleo_ceph_client/tasks/ceph_ansible.yml index 673bbd1c0..65edd8dd1 100644 --- a/tripleo_ansible/roles/tripleo_ceph_client/tasks/ceph_ansible.yml +++ b/tripleo_ansible/roles/tripleo_ceph_client/tasks/ceph_ansible.yml @@ -19,12 +19,14 @@ - name: Get ceph_mon_ip addresses set_fact: tripleo_ceph_client_mon_ips: "{{ (tripleo_ceph_client_mon_ips | default([])) - | union([(hostvars[item]['storage_ip'] - | default(hostvars[item]['ctlplane_ip']))]) }}" + | union([hostvars[item][tripleo_ceph_client_net]]) }}" loop: "{{ groups['ceph_mon'] | list }}" + vars: + tripleo_ceph_client_net: "{{ service_net_map['ceph_mon_network'] + '_ip' }}" when: - (tripleo_enabled_services | intersect(['ceph_mon'])) and (groups['ceph_mon'] | length > 0) + - name: Set external_cluster_mon_ips set_fact: external_cluster_mon_ips: "{{ ceph_ansible_group_vars_clients.external_cluster_mon_ips }}" @@ -32,6 +34,7 @@ when: - (ceph_ansible_group_vars_clients.external_cluster_mon_ips is defined) and (not tripleo_enabled_services | intersect(['ceph_mon'])) + - name: Prepare ceph config variables set_fact: tripleo_ceph_client_fsid: "{{ ceph_ansible_group_vars_all.fsid }}"