osd: fix monitor_name error when scaling out OSDs

This commit fixes a bug when trying to scale out osd nodes with
`crush_rule_config` is enabled.

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

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 4bcc52cb2a)
pull/5274/head
Guillaume Abrioux 2020-04-09 14:48:53 +02:00
parent e34c95d28f
commit 1b79d73729
1 changed files with 16 additions and 4 deletions

View File

@ -30,13 +30,25 @@
- name: set_fact monitor_name ansible_hostname
set_fact:
monitor_name: "{{ ansible_hostname }}"
when: not mon_use_fqdn | bool
monitor_name: "{{ hostvars[item]['ansible_hostname'] }}"
delegate_to: "{{ item }}"
delegate_facts: true
with_items: "{{ groups.get(mon_group_name, []) }}"
run_once: true
when:
- groups.get(mon_group_name, []) | length > 0
- not mon_use_fqdn | bool
- name: set_fact monitor_name ansible_fqdn
set_fact:
monitor_name: "{{ ansible_fqdn }}"
when: mon_use_fqdn | bool
monitor_name: "{{ hostvars[item]['ansible_fqdn'] }}"
delegate_to: "{{ item }}"
delegate_facts: true
with_items: "{{ groups.get(mon_group_name, []) }}"
run_once: true
when:
- groups.get(mon_group_name, []) | length > 0
- mon_use_fqdn | bool
- name: find a running monitor
when: groups.get(mon_group_name, []) | length > 0