facts: fix osp/ceph external use case

d6da508a9b broke the osp/ceph external use case.

We must skip these tasks when no monitor is present in the inventory.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1790508

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/4932/head
Guillaume Abrioux 2020-01-13 15:30:13 +01:00 committed by Dimitri Savineau
parent f940e695ab
commit 2592a1e1e8
1 changed files with 74 additions and 71 deletions

View File

@ -38,12 +38,14 @@
monitor_name: "{{ ansible_fqdn }}" monitor_name: "{{ ansible_fqdn }}"
when: mon_use_fqdn | bool when: mon_use_fqdn | bool
- name: find a running monitor
when: groups.get(mon_group_name, []) | length > 0
block:
- name: set_fact container_exec_cmd - name: set_fact container_exec_cmd
set_fact: set_fact:
container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] if not rolling_update else hostvars[mon_host | default(groups[mon_group_name][0])]['ansible_hostname'] }}" container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] if not rolling_update else hostvars[mon_host | default(groups[mon_group_name][0])]['ansible_hostname'] }}"
when: when:
- containerized_deployment | bool - containerized_deployment | bool
- groups.get(mon_group_name, []) | length > 0
- name: find a running mon container - name: find a running mon container
command: "{{ container_binary }} ps -q --filter name=ceph-mon-{{ hostvars[item]['ansible_hostname'] }}" command: "{{ container_binary }} ps -q --filter name=ceph-mon-{{ hostvars[item]['ansible_hostname'] }}"
@ -52,7 +54,8 @@
run_once: true run_once: true
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
with_items: "{{ groups.get(mon_group_name, []) }}" with_items: "{{ groups.get(mon_group_name, []) }}"
when: containerized_deployment | bool when:
- containerized_deployment | bool
- name: check for a ceph mon socket - name: check for a ceph mon socket
shell: stat --printf=%n {{ rbd_client_admin_socket_path }}/{{ cluster }}-mon*.asok shell: stat --printf=%n {{ rbd_client_admin_socket_path }}/{{ cluster }}-mon*.asok
@ -63,7 +66,8 @@
run_once: true run_once: true
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
with_items: "{{ groups.get(mon_group_name, []) }}" with_items: "{{ groups.get(mon_group_name, []) }}"
when: not containerized_deployment | bool when:
- not containerized_deployment | bool
- name: check if the ceph mon socket is in-use - name: check if the ceph mon socket is in-use
command: grep -q {{ item.stdout }} /proc/net/unix command: grep -q {{ item.stdout }} /proc/net/unix
@ -115,7 +119,6 @@
delegate_to: "{{ groups[mon_group_name][0] if running_mon is undefined else running_mon }}" delegate_to: "{{ groups[mon_group_name][0] if running_mon is undefined else running_mon }}"
when: when:
- not rolling_update | bool - not rolling_update | bool
- groups.get(mon_group_name, []) | length > 0
# set this as a default when performing a rolling_update # set this as a default when performing a rolling_update
# so the rest of the tasks here will succeed # so the rest of the tasks here will succeed