]> git-server-git.apps.pok.os.sepia.ceph.com Git - cephmetrics.git/commitdiff
ceph-mgr: Cope with differently-named containers
authorZack Cerza <zack@redhat.com>
Wed, 6 Jun 2018 19:23:22 +0000 (13:23 -0600)
committerZack Cerza <zack@redhat.com>
Fri, 8 Jun 2018 20:13:36 +0000 (14:13 -0600)
We were expecting ceph-mgr@hostname, but let's also look for
ceph-mgr-hostname.

Signed-off-by: Zack Cerza <zack@redhat.com>
ansible/roles/ceph-mgr/tasks/main.yml

index 7f7ea4ef82c256e9a39104736f385407534dd204..0a3617f430fadc9a88efabeaecad7fb45ef19b11 100644 (file)
@@ -8,14 +8,21 @@
   when: backend.metrics != 'mgr' or backend.storage != 'prometheus'
 
 - name: Check to see if the mgr is containerized
-  command: "docker inspect ceph-mgr@{{ ansible_hostname }}"
+  command: "docker inspect {{ item }}"
+  with_items:
+    - "ceph-mgr@{{ ansible_hostname }}"
+    - "ceph-mgr-{{ ansible_hostname }}"
   register: mgr_container
   failed_when: false
 
+- name: Choose the correct container name
+  set_fact:
+    container_name: "{% for res in mgr_container.results if res.rc == 0 %}{{ res.item }}{% endfor %}"
+
 - name: Prefix the mgr command with a docker command
   set_fact:
-    mgr_prefix: "docker exec ceph-mgr@{{ ansible_hostname }}"
-  when: mgr_container.rc == 0
+    mgr_prefix: "docker exec {{ container_name }}"
+  when: container_name != ""
 
 - name: Enable mgr prometheus module
   command: "{{ mgr_prefix|default('') }} ceph mgr module enable prometheus"