From b6dd8f112cd5506923b4b3ce51a1774b0bfc037c Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Mon, 11 Sep 2017 14:57:09 +0200 Subject: Pre-create a Cinder registry volume --- .../prepare-and-format-cinder-volume.yaml | 78 ++++++++++------------ 1 file changed, 35 insertions(+), 43 deletions(-) (limited to 'playbooks/provisioning/openstack/prepare-and-format-cinder-volume.yaml') diff --git a/playbooks/provisioning/openstack/prepare-and-format-cinder-volume.yaml b/playbooks/provisioning/openstack/prepare-and-format-cinder-volume.yaml index 2d630f79d..30e094459 100644 --- a/playbooks/provisioning/openstack/prepare-and-format-cinder-volume.yaml +++ b/playbooks/provisioning/openstack/prepare-and-format-cinder-volume.yaml @@ -18,56 +18,48 @@ attached_device: >- {{ volume_attachment['attachments']|json_query("[?volume_id=='" + cinder_volume + "'].device | [0]") }} + - delegate_to: "{{ groups['masters'][0] }}" + block: + - name: Wait for the device to appear + wait_for: path={{ attached_device }} -- hosts: masters[0] - gather_facts: False - become: True - tasks: - - name: Wait for the device to appear - wait_for: path={{ hostvars['localhost'].attached_device }} - - - name: Create a temp directory for mounting the volume - tempfile: - prefix: cinder-volume - state: directory - register: cinder_mount_dir + - name: Create a temp directory for mounting the volume + tempfile: + prefix: cinder-volume + state: directory + register: cinder_mount_dir - - name: Format the device - filesystem: - fstype: "{{ openshift_hosted_registry_storage_openstack_filesystem }}" - dev: "{{ hostvars['localhost'].attached_device }}" + - name: Format the device + filesystem: + fstype: "{{ cinder_fs }}" + dev: "{{ attached_device }}" - - name: Mount the device - mount: - name: "{{ cinder_mount_dir.path }}" - src: "{{ hostvars['localhost'].attached_device }}" - state: mounted - fstype: "{{ openshift_hosted_registry_storage_openstack_filesystem }}" + - name: Mount the device + mount: + name: "{{ cinder_mount_dir.path }}" + src: "{{ attached_device }}" + state: mounted + fstype: "{{ cinder_fs }}" - - name: Change mode on the filesystem - file: - path: "{{ cinder_mount_dir.path }}" - state: directory - recurse: true - mode: 0777 - - - name: Unmount the device - mount: - name: "{{ cinder_mount_dir.path }}" - src: "{{ hostvars['localhost'].attached_device }}" - state: absent - fstype: "{{ openshift_hosted_registry_storage_openstack_filesystem }}" + - name: Change mode on the filesystem + file: + path: "{{ cinder_mount_dir.path }}" + state: directory + recurse: true + mode: 0777 - - name: Delete the temp directory - file: - name: "{{ cinder_mount_dir.path }}" - state: absent + - name: Unmount the device + mount: + name: "{{ cinder_mount_dir.path }}" + src: "{{ attached_device }}" + state: absent + fstype: "{{ cinder_fs }}" + - name: Delete the temp directory + file: + name: "{{ cinder_mount_dir.path }}" + state: absent -- hosts: localhost - gather_facts: False - become: False - tasks: - name: Detach the volume from the VM os_server_volume: state: absent -- cgit v1.2.3