rolling_update: set num_osds to the number of running osds

We do this so that the ceph-config role can most accurately
report the number of osds for the generation of the ceph.conf
file.

We don't want to use ceph-volume to determine the number of
osds because in an upgrade to nautilus ceph-volume won't be able to
accurately count osds created by ceph-disk.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
(cherry picked from commit 67453853ff)
pull/3892/head
Andrew Schoen 2019-03-28 14:34:48 -05:00 committed by Guillaume Abrioux
parent 1e0e50fc90
commit 545d93aae8
2 changed files with 15 additions and 0 deletions

View File

@ -359,6 +359,12 @@
changed_when: false changed_when: false
when: containerized_deployment when: containerized_deployment
- name: set num_osds for container
set_fact:
num_osds: "{{ osd_names.stdout_lines|default([])|length }}"
when:
- containerized_deployment
- name: stop ceph osd - name: stop ceph osd
systemd: systemd:
name: ceph-osd@{{ item }} name: ceph-osd@{{ item }}
@ -369,6 +375,12 @@
when: when:
- not containerized_deployment - not containerized_deployment
- name: set num_osds for non container
set_fact:
num_osds: "{{ osd_ids.stdout_lines|default([])|length }}"
when:
- not containerized_deployment
- import_role: - import_role:
name: ceph-defaults name: ceph-defaults
- import_role: - import_role:

View File

@ -7,6 +7,9 @@
- name: config file operations related to OSDs - name: config file operations related to OSDs
when: when:
- inventory_hostname in groups.get(osd_group_name, []) - inventory_hostname in groups.get(osd_group_name, [])
# the rolling_update.yml playbook sets num_osds to the number of currently
# running osds
- not rolling_update
block: block:
- name: count number of osds for lvm scenario - name: count number of osds for lvm scenario
set_fact: set_fact: