From 76a663245de159e12735eb9f0705832e06fd802c Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Thu, 21 Jan 2021 12:12:17 -0500 Subject: [PATCH] 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 --- infrastructure-playbooks/cephadm-adopt.yml | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/infrastructure-playbooks/cephadm-adopt.yml b/infrastructure-playbooks/cephadm-adopt.yml index 46e099b82..3cc84cae7 100644 --- a/infrastructure-playbooks/cephadm-adopt.yml +++ b/infrastructure-playbooks/cephadm-adopt.yml @@ -408,7 +408,7 @@ when: not containerized_deployment | bool - name: set osd flags - hosts: "{{ mon_group_name|default('mons') }}[0]" + hosts: "{{ osd_group_name|default('osds') }}" become: true gather_facts: false tasks: @@ -416,13 +416,18 @@ name: ceph-defaults - name: set osd flags - command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd set {{ item }}" - changed_when: false + ceph_osd_flag: + cluster: "{{ cluster }}" + name: "{{ item }}" + state: present with_items: - noout - nodeep-scrub + delegate_to: "{{ groups[mon_group_name][0] }}" + run_once: true 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 hosts: "{{ osd_group_name|default('osd') }}" @@ -513,7 +518,7 @@ CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}' - name: unset osd flags - hosts: "{{ mon_group_name|default('mons') }}[0]" + hosts: "{{ osd_group_name|default('osds') }}" become: true gather_facts: false tasks: @@ -521,13 +526,18 @@ name: ceph-defaults - name: unset osd flags - command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} osd unset {{ item }}" - changed_when: false + ceph_osd_flag: + cluster: "{{ cluster }}" + name: "{{ item }}" + state: absent with_items: - noout - nodeep-scrub + delegate_to: "{{ groups[mon_group_name][0] }}" + run_once: true 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 hosts: "{{ mds_group_name|default('mdss') }}"