switch_to_containers: support iscsigws migration
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 7 Apr 2021 12:36:28 +0000 (14:36 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 9 Apr 2021 11:37:55 +0000 (13:37 +0200)
This adds the iscsigws migration to containers.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=<bz-number>
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml

index 41faba3753a73346048795287bb77024e6a765e5..005b880a3fa36cb7a023173b10d8961394e27c25 100644 (file)
     - import_role:
         name: ceph-nfs
 
+- name: switching from non-containerized to containerized iscsigws
+  hosts: "{{ iscsi_gw_group_name|default('iscsigws') }}"
+  vars:
+    containerized_deployment: true
+    iscsi_gw_group_name: iscsigws
+  become: true
+  serial: 1
+  pre_tasks:
+    - import_role:
+        name: ceph-defaults
+
+    - name: stop iscsigw services
+      service:
+        name: "{{ item }}"
+        state: stopped
+        enabled: no
+      with_items:
+        - tcmu-runner
+        - rbd-target-gw
+        - rbd-target-api
+
+    - name: remove old systemd unit files
+      file:
+        path: "/usr/lib/systemd/system/{{ item }}.service"
+        state: absent
+      with_items:
+        - tcmu-runner
+        - rbd-target-gw
+        - rbd-target-api
+  tasks:
+    - import_role:
+        name: ceph-facts
+
+    - import_role:
+        name: ceph-handler
+
+    # NOTE: changed from file module to raw find command for performance reasons
+    # The file module has to run checks on current ownership of all directories and files. This is unnecessary
+    # as in this case we know we want all owned by ceph user
+    - name: set proper ownership on ceph directories
+      command: "find /etc/ceph -not -( -user {{ ceph_uid }} -or -group {{ ceph_uid }} -) -execdir chown -h {{ ceph_uid }}:{{ ceph_uid }} {} +"
+      changed_when: false
+
+    - import_role:
+        name: ceph-container-engine
+
+    - import_role:
+        name: ceph-container-common
+
+    - import_role:
+        name: ceph-iscsi-gw
+
 - name: switching from non-containerized to containerized ceph-crash
 
   hosts: