]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
filestore-to-bluestore: add non containerized support
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 10 Dec 2019 10:07:30 +0000 (11:07 +0100)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Wed, 11 Dec 2019 14:04:41 +0000 (09:04 -0500)
This commit adds the non containerized context support to the
filestore-to-bluestore.yml infrastructure playbook.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1729267
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
infrastructure-playbooks/filestore-to-bluestore.yml

index 6e213f1c21a0c43a466536c1f580d12f221f274b..9eb998d5355baf39b09e1839888d374ba9a18c30 100644 (file)
       register: osd_tree
       run_once: true
 
+    - name: set_fact container_run_cmd
+      set_fact:
+        container_run_cmd: "{{ container_binary + ' run --rm --privileged=true --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host -v /dev:/dev -v /etc/ceph:/etc/ceph -v /var/lib/ceph:/var/lib/ceph -v /var/run:/var/run --entrypoint=' if containerized_deployment else '' }}ceph-volume {{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else '' }}"
+
     - name: get ceph-volume lvm inventory data
-      command: >
-        {{ container_binary }} run --rm --privileged=true
-        --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
-        -v /dev:/dev -v /etc/ceph:/ceph/ceph
-        -v /var/lib/ceph:/var/lib/ceph
-        -v /var/run:/var/run
-        --entrypoint=ceph-volume
-        {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-        inventory --format json
+      command: "{{ container_run_cmd }} --cluster {{ cluster }} inventory --format json"
       register: ceph_volume_inventory
 
     - name: set_fact inventory
           with_items: "{{ ceph_disk_osds_devices | default([]) }}"
 
         - name: get simple scan data
-          command: >
-            {{ container_binary }} run --rm --privileged=true
-            --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
-            -v /dev:/dev -v /etc/ceph:/etc/ceph
-            -v /var/lib/ceph:/var/lib/ceph
-            -v /var/run:/var/run
-            --entrypoint=ceph-volume
-            {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-            simple scan {{ item.item + 'p1' if item.item is match('/dev/(cciss/c[0-9]d[0-9]|nvme[0-9]n[0-9]){1,2}$') else item.item + '1' }} --stdout
+          command: "{{ container_run_cmd }} --cluster {{ cluster }} simple scan {{ item.item + 'p1' if item.item is match('/dev/(cciss/c[0-9]d[0-9]|nvme[0-9]n[0-9]){1,2}$') else item.item + '1' }} --stdout"
           register: simple_scan
           with_items: "{{ partlabel.results | default([]) }}"
           when: item.stdout == 'ceph data'
           failed_when: false
           changed_when: false
           when:
-            - (item.0.stdout | from_json).encrypted | default(False)
-            -
             - item.1.stdout == 'ceph data'
+            - (item.0.stdout | from_json).encrypted | default(False)
 
         - name: ensure dmcrypt for journal device is closed
           command: cryptsetup close "{{ (item.0.stdout | from_json).journal.uuid }}"
           failed_when: false
           changed_when: false
           when:
-            - (item.0.stdout | from_json).encrypted | default(False)
             - item.1.stdout == 'ceph data'
+            - (item.0.stdout | from_json).encrypted | default(False)
 
         - name: zap data devices
-          command: >
-            {{ container_binary }} run --rm --privileged=true
-            --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
-            -v /dev:/dev -v /etc/ceph:/etc/ceph
-            -v /var/lib/ceph:/var/lib/ceph
-            -v /var/run:/var/run
-            --entrypoint=ceph-volume
-            {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-            lvm zap --destroy {{ (item.0.stdout | from_json).data.path }}
+          command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm zap --destroy {{ (item.0.stdout | from_json).data.path }}"
           with_together:
             - "{{ simple_scan.results }}"
             - "{{ partlabel.results }}"
           when: item.1.stdout == 'ceph data'
 
         - name: zap journal devices
-          command: >
-            {{ container_binary }} run --rm --privileged=true
-            --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
-            -v /dev:/dev -v /etc/ceph:/etc/ceph
-            -v /var/lib/ceph:/var/lib/ceph
-            -v /var/run:/var/run
-            --entrypoint=ceph-volume
-            {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-            lvm zap --destroy {{ (item.0.stdout | from_json).journal.path }}
+          command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm zap --destroy {{ (item.0.stdout | from_json).journal.path }}"
           with_together:
             - "{{ simple_scan.results }}"
             - "{{ partlabel.results }}"
             - (item.0.stdout | from_json).journal.path is defined
 
     - name: get ceph-volume lvm list data
-      command: >
-        {{ container_binary }} run --rm --privileged=true
-        --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
-        -v /dev:/dev -v /etc/ceph:/ceph/ceph
-        -v /var/lib/ceph:/var/lib/ceph
-        -v /var/run:/var/run
-        --entrypoint=ceph-volume
-        {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-        lvm list --format json
+      command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm list --format json"
       register: ceph_volume_lvm_list
 
     - name: set_fact _lvm_list
           with_items: "{{ _lvm_list }}"
           changed_when: false
           failed_when: false
-          when: item['tags']['ceph.encrypted'] | int == 1
+          when: item['tags'].get('ceph.encrypted', 0) | int == 1
 
         - name: set_fact osd_fsid_list
           set_fact:
         name: ceph-handler
     - import_role:
         name: ceph-container-common
+      when: containerized_deployment | bool
     - import_role:
         name: ceph-osd
       vars: