]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
cephadm-adopt: use ceph_osd_flag module
authorDimitri Savineau <dsavinea@redhat.com>
Thu, 21 Jan 2021 17:12:17 +0000 (12:12 -0500)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 3 Feb 2021 07:29:31 +0000 (08:29 +0100)
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>
infrastructure-playbooks/cephadm-adopt.yml

index 46e099b823b0fd8c06b20b82b4d21cfd5f17e51a..3cc84cae70aace0fedbb59eac15d012fe922c31e 100644 (file)
       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:
         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') }}"
         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:
         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') }}"