mirror of https://github.com/ceph/ceph-ansible.git
switch: do not look for devices anymore
It's easier lookup a directoriy instead of the block devices,
especially because of ceph-volume and ceph-disk have a different way to
handle devices.
Signed-off-by: Sébastien Han <seb@redhat.com>
(cherry picked from commit c14f9b78ff
)
pull/3384/head
parent
57ac7b94c0
commit
26ea96424c
|
@ -204,23 +204,7 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: collect osd devices
|
- name: stop/disable/mask non-containerized ceph osd(s) and ceph-disk units (if any)
|
||||||
shell: |
|
|
||||||
blkid | awk '/ceph data/ { sub ("1:", "", $1); print $1 }'
|
|
||||||
register: collect_devices
|
|
||||||
changed_when: false
|
|
||||||
when:
|
|
||||||
- devices is not defined or (devices is defined and devices == [])
|
|
||||||
|
|
||||||
- name: set devices
|
|
||||||
set_fact:
|
|
||||||
devices: "{{ collect_devices.stdout_lines | list }}"
|
|
||||||
when:
|
|
||||||
- collect_devices is defined
|
|
||||||
- not collect_devices.get("skipped")
|
|
||||||
- collect_devices != []
|
|
||||||
|
|
||||||
- name: stop/disable non-containerized ceph osd(s), ceph-disk units (if any) and ceph-volume units (if any)
|
|
||||||
systemd:
|
systemd:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: stopped
|
state: stopped
|
||||||
|
@ -275,28 +259,27 @@
|
||||||
- ldb_files.rc == 0
|
- ldb_files.rc == 0
|
||||||
|
|
||||||
- name: check if containerized osds are already running
|
- name: check if containerized osds are already running
|
||||||
shell: |
|
command: >
|
||||||
docker ps | grep -sq {{ item | regex_replace('/', '') }}
|
docker ps --filter='name=ceph-osd'
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
with_items: "{{ devices }}"
|
|
||||||
register: osd_running
|
register: osd_running
|
||||||
|
|
||||||
- name: resolve device(s) path(s)
|
- name: get osd directories
|
||||||
command: readlink -f {{ item }}
|
command: >
|
||||||
|
ls -1 /var/lib/ceph/osd
|
||||||
|
register: osd_dirs
|
||||||
changed_when: false
|
changed_when: false
|
||||||
with_items: "{{ devices }}"
|
|
||||||
register: devices_canonicalize
|
|
||||||
|
|
||||||
- name: unmount all the osd directories
|
- name: unmount all the osd directories
|
||||||
command: umount "{{ item.0.stdout }}"1
|
command: >
|
||||||
|
umount /var/lib/ceph/osd/{{ item }}
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
with_together:
|
with_items:
|
||||||
- "{{ devices_canonicalize.results }}"
|
- "{{ osd_dirs.stdout_lines }}"
|
||||||
- "{{ osd_running.results }}"
|
|
||||||
when:
|
when:
|
||||||
- item.1.get("rc", 0) != 0
|
- osd_running.rc != 0
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- ceph-defaults
|
- ceph-defaults
|
||||||
|
|
Loading…
Reference in New Issue