mirror of https://github.com/ceph/ceph-ansible.git
cephadm-adopt: fix mgr placement hosts task
When no `[mgrs]` group is defined in the inventory, mgr daemon are implicitly collocated with monitors. This task currently relies on the length of the mgr group in order to tell cephadm to deploy mgr daemons. If there's no `[mgrs]` group defined in the inventory, it will ask cephadm to deploy 0 mgr daemon which doesn't make sense and will throw an error. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1970313 Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>pull/6596/head
parent
b49cdea750
commit
f9a73149a4
|
@ -389,7 +389,7 @@
|
||||||
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
||||||
|
|
||||||
- name: adopt ceph mgr daemons
|
- name: adopt ceph mgr daemons
|
||||||
hosts: "{{ mgr_group_name|default('mgrs') }}"
|
hosts: "{{ groups[mgr_group_name] | default(groups[mon_group_name]) }}"
|
||||||
serial: 1
|
serial: 1
|
||||||
become: true
|
become: true
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
@ -1229,8 +1229,16 @@
|
||||||
environment:
|
environment:
|
||||||
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
||||||
|
|
||||||
|
- name: set_fact mgr_placement
|
||||||
|
set_fact:
|
||||||
|
mgr_placement_count: "{{ groups.get(mgr_group_name, []) | length if groups.get(mgr_group_name, []) | length > 0 else groups.get(mon_group_name, []) | length }}"
|
||||||
|
|
||||||
|
- name: set_fact mgr_placement_label
|
||||||
|
set_fact:
|
||||||
|
mgr_placement_label: "{{ mgr_group_name if groups.get(mgr_group_name, []) | length > 0 else mon_group_name }}"
|
||||||
|
|
||||||
- name: update the placement of manager hosts
|
- name: update the placement of manager hosts
|
||||||
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} orch apply mgr --placement='{{ groups.get(mgr_group_name, []) | length }} label:{{ mgr_group_name }}'"
|
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} orch apply mgr --placement='{{ mgr_placement_count }} label:{{ mgr_placement_label }}'"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
environment:
|
environment:
|
||||||
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
||||||
|
|
Loading…
Reference in New Issue