update: use ids to restart osds instead of device name

we must use the ids instead of device names in the tasks executed in
`post_tasks` for the osd rolling update otherwise it ends up with old
systemd units enabled.

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

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/4337/head v3.2.24
Guillaume Abrioux 2019-08-13 11:13:30 +02:00
parent 81906344ee
commit 787a6e879e
1 changed files with 4 additions and 28 deletions

View File

@ -340,17 +340,10 @@
become: True become: True
pre_tasks: pre_tasks:
- name: get osd numbers - non container - name: get osd numbers
shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi" shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi"
register: osd_ids register: osd_ids
changed_when: false changed_when: false
when: not containerized_deployment
- name: get osd unit names - container
shell: systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([a-z0-9]+).service"
register: osd_names
changed_when: false
when: containerized_deployment
- name: stop ceph osd - name: stop ceph osd
systemd: systemd:
@ -371,30 +364,13 @@
- ceph-osd - ceph-osd
post_tasks: post_tasks:
- name: get osd numbers - name: restart ceph osd
shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi"
register: osd_ids
changed_when: false
when: not containerized_deployment
- name: start ceph osd
systemd: systemd:
name: ceph-osd@{{ item }} name: "ceph-osd@{{ item }}"
state: started
enabled: yes
with_items: "{{ osd_ids.stdout_lines }}"
when:
- not containerized_deployment
- name: restart containerized ceph osd
systemd:
name: "{{ item }}"
state: restarted state: restarted
enabled: yes enabled: yes
daemon_reload: yes daemon_reload: yes
with_items: "{{ osd_names.stdout_lines }}" with_items: "{{ osd_ids.stdout_lines }}"
when:
- containerized_deployment
- name: set_fact docker_exec_cmd_osd - name: set_fact docker_exec_cmd_osd
set_fact: set_fact: