mirror of https://github.com/ceph/ceph-ansible.git
common: support OSDs with more than 2 digits
When running environment with OSDs having ID with more than 2 digits, some tasks don't match the system units and therefore, playbook can fail. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1805643 Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>pull/5099/head
parent
1de2bf9991
commit
a084a2a347
|
@ -251,7 +251,7 @@
|
||||||
|
|
||||||
- name: get all the running osds
|
- name: get all the running osds
|
||||||
shell: |
|
shell: |
|
||||||
systemctl list-units | grep 'loaded[[:space:]]\+active' | grep -oE "ceph-osd@([0-9]{1,2}|[a-z]+).service"
|
systemctl list-units | grep 'loaded[[:space:]]\+active' | grep -oE "ceph-osd@([0-9]+).service"
|
||||||
register: osd_units
|
register: osd_units
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
|
|
@ -385,7 +385,7 @@
|
||||||
when: not containerized_deployment | bool
|
when: not containerized_deployment | bool
|
||||||
|
|
||||||
- name: get osd unit names - container
|
- name: get osd unit names - container
|
||||||
shell: systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([a-z0-9]+).service"
|
shell: systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([0-9]+).service"
|
||||||
register: osd_names
|
register: osd_names
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when: containerized_deployment | bool
|
when: containerized_deployment | bool
|
||||||
|
|
|
@ -55,7 +55,7 @@ get_container_id_from_dev_name() {
|
||||||
|
|
||||||
# For containerized deployments, the unit file looks like: ceph-osd@sda.service
|
# For containerized deployments, the unit file looks like: ceph-osd@sda.service
|
||||||
# For non-containerized deployments, the unit file looks like: ceph-osd@NNN.service where NNN is OSD ID
|
# For non-containerized deployments, the unit file looks like: ceph-osd@NNN.service where NNN is OSD ID
|
||||||
for unit in $(systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([0-9]+|[a-z]+).service"); do
|
for unit in $(systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([0-9]+).service"); do
|
||||||
# First, restart daemon(s)
|
# First, restart daemon(s)
|
||||||
systemctl restart "${unit}"
|
systemctl restart "${unit}"
|
||||||
# We need to wait because it may take some time for the socket to actually exists
|
# We need to wait because it may take some time for the socket to actually exists
|
||||||
|
|
Loading…
Reference in New Issue