From: Zack Cerza Date: Wed, 6 Jun 2018 19:23:22 +0000 (-0600) Subject: ceph-mgr: Cope with differently-named containers X-Git-Tag: v2.0~20^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c3ad18e67b3f7cd9e1e45baf0daafb13860c3b8f;p=cephmetrics.git ceph-mgr: Cope with differently-named containers We were expecting ceph-mgr@hostname, but let's also look for ceph-mgr-hostname. Signed-off-by: Zack Cerza --- diff --git a/ansible/roles/ceph-mgr/tasks/main.yml b/ansible/roles/ceph-mgr/tasks/main.yml index 7f7ea4e..0a3617f 100644 --- a/ansible/roles/ceph-mgr/tasks/main.yml +++ b/ansible/roles/ceph-mgr/tasks/main.yml @@ -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"