mirror of https://github.com/ceph/ceph-ansible.git
rolling_update: fix pre and post osd upgrade play
when using --limit osds, the play before and after osd upgrade are
skipped because we use `hosts: "{{ mon_group_name | default('mons') }}[0]"`
using `hosts: "{{ osds_group_name | default('osds') }}" with
`delegate_to` to the first monitor addresses this issue.
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit fc9f87c45f
)
pull/6964/head
parent
e29defef7d
commit
efc6979db5
|
@ -423,7 +423,7 @@
|
||||||
|
|
||||||
|
|
||||||
- name: set osd flags
|
- name: set osd flags
|
||||||
hosts: "{{ mon_group_name | default('mons') }}[0]"
|
hosts: "{{ osd_group_name | default('osds') }}"
|
||||||
tags: osds
|
tags: osds
|
||||||
become: True
|
become: True
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
@ -434,52 +434,56 @@
|
||||||
name: ceph-facts
|
name: ceph-facts
|
||||||
tasks_from: container_binary.yml
|
tasks_from: container_binary.yml
|
||||||
|
|
||||||
- name: get pool list
|
- name: set osd flags, disable autoscaler and balancer
|
||||||
command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json"
|
|
||||||
register: pool_list
|
|
||||||
run_once: true
|
run_once: true
|
||||||
changed_when: false
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||||
check_mode: false
|
block:
|
||||||
|
- name: get pool list
|
||||||
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json"
|
||||||
|
register: pool_list
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
|
||||||
- name: get balancer module status
|
- name: get balancer module status
|
||||||
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer status -f json"
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer status -f json"
|
||||||
register: balancer_status_update
|
register: balancer_status_update
|
||||||
changed_when: false
|
run_once: true
|
||||||
check_mode: false
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
|
||||||
- name: set_fact pools_pgautoscaler_mode
|
- name: set_fact pools_pgautoscaler_mode
|
||||||
set_fact:
|
set_fact:
|
||||||
pools_pgautoscaler_mode: "{{ pools_pgautoscaler_mode | default([]) | union([{'name': item.pool_name, 'mode': item.pg_autoscale_mode}]) }}"
|
pools_pgautoscaler_mode: "{{ pools_pgautoscaler_mode | default([]) | union([{'name': item.pool_name, 'mode': item.pg_autoscale_mode}]) }}"
|
||||||
with_items: "{{ pool_list.stdout | default('{}') | from_json }}"
|
with_items: "{{ pool_list.stdout | default('{}') | from_json }}"
|
||||||
|
|
||||||
- name: disable balancer
|
- name: disable balancer
|
||||||
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off"
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off"
|
||||||
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: disable pg autoscale on pools
|
- name: disable pg autoscale on pools
|
||||||
ceph_pool:
|
ceph_pool:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
pg_autoscale_mode: false
|
pg_autoscale_mode: false
|
||||||
with_items: "{{ pools_pgautoscaler_mode }}"
|
with_items: "{{ pools_pgautoscaler_mode }}"
|
||||||
when:
|
when:
|
||||||
- pools_pgautoscaler_mode is defined
|
- pools_pgautoscaler_mode is defined
|
||||||
- item.mode == 'on'
|
- item.mode == 'on'
|
||||||
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 }}"
|
||||||
|
|
||||||
- name: set osd flags
|
- name: set osd flags
|
||||||
ceph_osd_flag:
|
ceph_osd_flag:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
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:
|
with_items:
|
||||||
- noout
|
- noout
|
||||||
- nodeep-scrub
|
- nodeep-scrub
|
||||||
|
|
||||||
- name: upgrade ceph osds cluster
|
- name: upgrade ceph osds cluster
|
||||||
vars:
|
vars:
|
||||||
|
@ -562,7 +566,7 @@
|
||||||
|
|
||||||
|
|
||||||
- name: complete osd upgrade
|
- name: complete osd upgrade
|
||||||
hosts: "{{ mon_group_name|default('mons') }}[0]"
|
hosts: "{{ osd_group_name | default('osds') }}"
|
||||||
tags: osds
|
tags: osds
|
||||||
become: True
|
become: True
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
@ -573,35 +577,39 @@
|
||||||
name: ceph-facts
|
name: ceph-facts
|
||||||
tasks_from: container_binary.yml
|
tasks_from: container_binary.yml
|
||||||
|
|
||||||
- name: re-enable pg autoscale on pools
|
- name: unset osd flags, re-enable pg autoscaler and balancer
|
||||||
ceph_pool:
|
run_once: true
|
||||||
name: "{{ item.name }}"
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||||
cluster: "{{ cluster }}"
|
block:
|
||||||
pg_autoscale_mode: true
|
- name: re-enable pg autoscale on pools
|
||||||
with_items: "{{ pools_pgautoscaler_mode }}"
|
ceph_pool:
|
||||||
when:
|
name: "{{ item.name }}"
|
||||||
- pools_pgautoscaler_mode is defined
|
cluster: "{{ cluster }}"
|
||||||
- item.mode == 'on'
|
pg_autoscale_mode: true
|
||||||
environment:
|
with_items: "{{ pools_pgautoscaler_mode }}"
|
||||||
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
when:
|
||||||
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
- pools_pgautoscaler_mode is defined
|
||||||
|
- item.mode == 'on'
|
||||||
|
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 flags
|
||||||
ceph_osd_flag:
|
ceph_osd_flag:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
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:
|
with_items:
|
||||||
- noout
|
- noout
|
||||||
- nodeep-scrub
|
- nodeep-scrub
|
||||||
|
|
||||||
- name: re-enable balancer
|
- name: re-enable balancer
|
||||||
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on"
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on"
|
||||||
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: 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]"
|
||||||
|
|
Loading…
Reference in New Issue