cephadm-adopt: use ceph_osd_flag module

There's no reason to not use the ceph_osd_flag module to set/unset osd
flags.
Also if there's no OSD nodes in the inventory then we don't need to
execute the set/unset play.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
pull/6238/head
Dimitri Savineau 2021-01-21 12:12:17 -05:00 committed by Guillaume Abrioux
parent 36fc04eaab
commit 76a663245d
1 changed files with 18 additions and 8 deletions

View File

@ -408,7 +408,7 @@
when: not containerized_deployment | bool when: not containerized_deployment | bool
- name: set osd flags - name: set osd flags
hosts: "{{ mon_group_name|default('mons') }}[0]" hosts: "{{ osd_group_name|default('osds') }}"
become: true become: true
gather_facts: false gather_facts: false
tasks: tasks:
@ -416,13 +416,18 @@
name: ceph-defaults name: ceph-defaults
- name: set osd flags - name: set osd flags
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd set {{ item }}" ceph_osd_flag:
changed_when: false cluster: "{{ cluster }}"
name: "{{ item }}"
state: present
with_items: with_items:
- noout - noout
- nodeep-scrub - nodeep-scrub
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
environment: environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' 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: adopt ceph osd daemons - name: adopt ceph osd daemons
hosts: "{{ osd_group_name|default('osd') }}" hosts: "{{ osd_group_name|default('osd') }}"
@ -513,7 +518,7 @@
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 flags
hosts: "{{ mon_group_name|default('mons') }}[0]" hosts: "{{ osd_group_name|default('osds') }}"
become: true become: true
gather_facts: false gather_facts: false
tasks: tasks:
@ -521,13 +526,18 @@
name: ceph-defaults name: ceph-defaults
- name: unset osd flags - name: unset osd flags
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd unset {{ item }}" ceph_osd_flag:
changed_when: false cluster: "{{ cluster }}"
name: "{{ item }}"
state: absent
with_items: with_items:
- noout - noout
- nodeep-scrub - nodeep-scrub
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
environment: environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' 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: redeploy mds daemons - name: redeploy mds daemons
hosts: "{{ mds_group_name|default('mdss') }}" hosts: "{{ mds_group_name|default('mdss') }}"