infrastructure-playbooks: Run shrink-osd tasks on monitor

Instead of running shring-osd tasks on localhost and delegating most of
them to the first monitor, run all of them on the first monitor
directly.

This has the added advantage of becoming root on the monitor only, not
on localhost.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
(cherry picked from commit 8b3df4e418)
pull/5097/head
Benoît Knecht 2020-01-03 10:38:20 +01:00 committed by Dimitri Savineau
parent f5e2a69134
commit 10b3bb2727
1 changed files with 1 additions and 7 deletions

View File

@ -23,7 +23,7 @@
- name: confirm whether user really meant to remove osd(s) from the cluster - name: confirm whether user really meant to remove osd(s) from the cluster
hosts: localhost hosts: "{{ groups[mon_group_name][0] }}"
become: true become: true
@ -71,14 +71,12 @@
command: "{{ container_exec_cmd }} timeout 5 ceph --cluster {{ cluster }} health" command: "{{ container_exec_cmd }} timeout 5 ceph --cluster {{ cluster }} health"
register: ceph_health register: ceph_health
until: ceph_health.stdout.find("HEALTH") > -1 until: ceph_health.stdout.find("HEALTH") > -1
delegate_to: "{{ groups[mon_group_name][0] }}"
retries: 5 retries: 5
delay: 2 delay: 2
- name: find the host(s) where the osd(s) is/are running on - name: find the host(s) where the osd(s) is/are running on
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} osd find {{ item }}" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} osd find {{ item }}"
with_items: "{{ osd_to_kill.split(',') }}" with_items: "{{ osd_to_kill.split(',') }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
register: find_osd_hosts register: find_osd_hosts
- name: set_fact osd_hosts - name: set_fact osd_hosts
@ -97,7 +95,6 @@
- name: mark osd(s) out of the cluster - name: mark osd(s) out of the cluster
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} osd out {{ osd_to_kill.replace(',', ' ') }}" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} osd out {{ osd_to_kill.replace(',', ' ') }}"
run_once: true run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
- name: stop osd(s) service - name: stop osd(s) service
service: service:
@ -121,13 +118,10 @@
- name: purge osd(s) from the cluster - name: purge osd(s) from the cluster
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} osd purge {{ item }} --yes-i-really-mean-it" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} osd purge {{ item }} --yes-i-really-mean-it"
run_once: true run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
with_items: "{{ osd_to_kill.split(',') }}" with_items: "{{ osd_to_kill.split(',') }}"
- name: show ceph health - name: show ceph health
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} -s" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} -s"
delegate_to: "{{ groups[mon_group_name][0] }}"
- name: show ceph osd tree - name: show ceph osd tree
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} osd tree" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} osd tree"
delegate_to: "{{ groups[mon_group_name][0] }}"