day2: set noout at the bucket level instead

It is safer to set the `noout` flag at the bucket level instead of the
whole cluster.
This commit updates the 3 playbooks where we set `noout` flag so it
doesn't set it at the whole cluster level anymore.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
refact_module_osd_flag
Guillaume Abrioux 2020-12-16 11:38:20 +01:00
parent 80a36f881d
commit 66741ff14f
3 changed files with 95 additions and 27 deletions

View File

@ -694,8 +694,8 @@
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: set osd flags - name: set osd flag nodeep-scrub
hosts: "{{ osd_group_name|default('osds') }}" hosts: "{{ mon_group_name|default('mons') }}[0]"
become: true become: true
gather_facts: false gather_facts: false
any_errors_fatal: True any_errors_fatal: True
@ -707,7 +707,6 @@
command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json" command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json"
register: pool_list register: pool_list
run_once: true run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false changed_when: false
check_mode: false check_mode: false
@ -715,7 +714,6 @@
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer status -f json" command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer status -f json"
register: balancer_status_adopt register: balancer_status_adopt
run_once: true run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false changed_when: false
check_mode: false check_mode: false
@ -738,7 +736,6 @@
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
pg_autoscale_mode: false pg_autoscale_mode: false
with_items: "{{ pools_pgautoscaler_mode }}" with_items: "{{ pools_pgautoscaler_mode }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true run_once: true
when: when:
- pools_pgautoscaler_mode is defined - pools_pgautoscaler_mode is defined
@ -755,7 +752,6 @@
with_items: with_items:
- noout - noout
- nodeep-scrub - nodeep-scrub
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true run_once: true
environment: environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
@ -776,6 +772,12 @@
tasks_from: container_binary.yml tasks_from: container_binary.yml
when: containerized_deployment | bool when: containerized_deployment | bool
- name: set osd flag noout
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd set-group noout {{ inventory_hostname }}"
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: get osd list - name: get osd list
ceph_volume: ceph_volume:
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
@ -850,8 +852,14 @@
environment: environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: unset osd flags - name: unset osd flag noout
hosts: "{{ osd_group_name|default('osds') }}" command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd unset-group noout {{ inventory_hostname }}"
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: unset osd flag nodeep-scrub
hosts: "{{ mon_group_name|default('mons') }}[0]"
become: true become: true
gather_facts: false gather_facts: false
any_errors_fatal: True any_errors_fatal: True
@ -865,7 +873,6 @@
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
pg_autoscale_mode: true pg_autoscale_mode: true
with_items: "{{ pools_pgautoscaler_mode }}" with_items: "{{ pools_pgautoscaler_mode }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true run_once: true
when: when:
- pools_pgautoscaler_mode is defined - pools_pgautoscaler_mode is defined
@ -882,8 +889,11 @@
with_items: with_items:
- noout - noout
- nodeep-scrub - nodeep-scrub
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true run_once: true
- name: unset osd flag nodeep-scrub
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd unset nodeep-scrub"
changed_when: false
environment: environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}"
@ -891,7 +901,6 @@
- name: re-enable balancer - name: re-enable balancer
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on" command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on"
run_once: true run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
changed_when: false changed_when: false
when: (balancer_status_adopt.stdout | from_json)['active'] | bool when: (balancer_status_adopt.stdout | from_json)['active'] | bool

View File

@ -412,9 +412,8 @@
name: ceph-mgr name: ceph-mgr
- name: set osd flags - name: set osd flag nodeep-scrub
hosts: "{{ osd_group_name | default('osds') }}" hosts: "{{ mon_group_name | default('mons') }}[0]"
tags: osds
become: True become: True
gather_facts: false gather_facts: false
tasks: tasks:
@ -426,7 +425,6 @@
- name: set osd flags, disable autoscaler and balancer - name: set osd flags, disable autoscaler and balancer
run_once: true run_once: true
delegate_to: "{{ groups[mon_group_name][0] }}"
block: block:
- name: get pool list - name: get pool list
command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json" command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json"
@ -475,6 +473,14 @@
- noout - noout
- nodeep-scrub - nodeep-scrub
- name: set osd flag nodeep-scrub
ceph_osd_flag:
name: "nodeep-scrub"
cluster: "{{ cluster }}"
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
- name: upgrade ceph osds cluster - name: upgrade ceph osds cluster
vars: vars:
health_osd_check_retries: 600 health_osd_check_retries: 600
@ -491,6 +497,17 @@
- import_role: - import_role:
name: ceph-facts name: ceph-facts
- name: set osd flag noout
ceph_osd_flag:
name: noout
level: bucket
bucket: "{{ inventory_hostname }}"
cluster: "{{ cluster }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
- name: get osd numbers - non container - name: get osd numbers - non container
shell: if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi # noqa 306 shell: if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi # noqa 306
register: osd_ids register: osd_ids
@ -554,6 +571,18 @@
retries: "{{ health_osd_check_retries }}" retries: "{{ health_osd_check_retries }}"
delay: "{{ health_osd_check_delay }}" delay: "{{ health_osd_check_delay }}"
- name: unset osd flag noout
ceph_osd_flag:
name: noout
state: absent
level: bucket
bucket: "{{ inventory_hostname }}"
cluster: "{{ cluster }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
- name: complete osd upgrade - name: complete osd upgrade
hosts: "{{ osd_group_name | default('osds') }}" hosts: "{{ osd_group_name | default('osds') }}"
@ -601,6 +630,16 @@
changed_when: false changed_when: false
when: (balancer_status_update.stdout | from_json)['active'] | bool when: (balancer_status_update.stdout | from_json)['active'] | bool
- name: unset osd flag nodeep-scrub
ceph_osd_flag:
name: "nodeep-scrub"
cluster: "{{ cluster }}"
state: absent
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
- name: upgrade ceph mdss cluster, deactivate all rank > 0 - name: upgrade ceph mdss cluster, deactivate all rank > 0
hosts: "{{ mon_group_name | default('mons') }}[0]" hosts: "{{ mon_group_name | default('mons') }}[0]"
tags: mdss tags: mdss

View File

@ -213,7 +213,7 @@
name: ceph-mgr name: ceph-mgr
- name: set osd flags - name: set osd flag nodeep-scrub
hosts: "{{ mon_group_name | default('mons') }}[0]" hosts: "{{ mon_group_name | default('mons') }}[0]"
become: True become: True
tasks: tasks:
@ -258,16 +258,13 @@
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}"
- name: set osd flags - name: set osd flag nodeep-scrub
ceph_osd_flag: ceph_osd_flag:
name: "{{ item }}" name: "nodeep-scrub"
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
environment: environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}"
with_items:
- noout
- nodeep-scrub
- name: switching from non-containerized to containerized ceph osd - name: switching from non-containerized to containerized ceph osd
@ -286,6 +283,21 @@
- import_role: - import_role:
name: ceph-defaults name: ceph-defaults
- import_role:
name: ceph-facts
tasks_from: container_binary.yml
- name: set osd flag noout
ceph_osd_flag:
name: noout
level: bucket
bucket: "{{ inventory_hostname }}"
cluster: "{{ cluster }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
- name: collect running osds - name: collect running osds
shell: | shell: |
set -o pipefail; set -o pipefail;
@ -398,8 +410,19 @@
delay: "{{ health_osd_check_delay }}" delay: "{{ health_osd_check_delay }}"
changed_when: false changed_when: false
- name: unset osd flag noout
ceph_osd_flag:
name: noout
state: absent
level: bucket
bucket: "{{ inventory_hostname }}"
cluster: "{{ cluster }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
- name: unset osd flags - name: unset osd flag nodeep-scrub
hosts: "{{ mon_group_name | default('mons') }}[0]" hosts: "{{ mon_group_name | default('mons') }}[0]"
become: True become: True
tasks: tasks:
@ -422,17 +445,14 @@
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}"
- name: unset osd flags - name: set osd flag nodeep-scrub
ceph_osd_flag: ceph_osd_flag:
name: "{{ item }}" name: "nodeep-scrub"
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
state: absent state: absent
environment: environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}"
with_items:
- noout
- nodeep-scrub
- name: re-enable balancer - name: re-enable balancer
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on" command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on"