summaryrefslogtreecommitdiffstats
path: root/tools/cicdansible/roles/setup_openstack_infrastructure/tasks/configure/volume.yml
diff options
context:
space:
mode:
Diffstat (limited to 'tools/cicdansible/roles/setup_openstack_infrastructure/tasks/configure/volume.yml')
-rw-r--r--tools/cicdansible/roles/setup_openstack_infrastructure/tasks/configure/volume.yml47
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/cicdansible/roles/setup_openstack_infrastructure/tasks/configure/volume.yml b/tools/cicdansible/roles/setup_openstack_infrastructure/tasks/configure/volume.yml
new file mode 100644
index 00000000..8c553850
--- /dev/null
+++ b/tools/cicdansible/roles/setup_openstack_infrastructure/tasks/configure/volume.yml
@@ -0,0 +1,47 @@
+#Configure a single openstack volume.
+- name: "Set volume path"
+ set_fact:
+ volume_path: "/dev/disk/by-id/virtio-{{ volume_id | truncate(20, True, '') }}"
+- name: "Set partition path"
+ set_fact:
+ partition_path: "{{ volume_path }}-part1"
+- name: "Wait for volume"
+ #We do not do it normally, because we want to trigger udev (workaround for some bugs).
+ shell: "udevadm trigger && udevadm settle && [[ -b {{ volume_path }} ]]"
+ register: result
+ retries: 30
+ delay: 10
+ until: result.rc == 0
+- name: "Partition volume"
+ parted:
+ device: "{{ volume_path }}"
+ number: 1
+ label: msdos
+ flags: boot
+ part_type: primary
+ state: present
+- name: "Wait for partition to appear"
+ stat:
+ path: "{{ partition_path }}"
+ follow: true
+ register: part_stat
+ delay: 1
+ retries: 5
+ until: part_stat.stat.isblk is defined and part_stat.stat.isblk
+- name: "Create xfs filesystem on volume"
+ filesystem:
+ dev: "{{ partition_path }}"
+ type: xfs
+- name: "Ensure that the mountpoint exists"
+ file:
+ path: "{{ mountpoint }}"
+ owner: root
+ group: root
+ mode: 0755
+ state: directory
+- name: "Mount filesystem"
+ mount:
+ src: "{{ partition_path }}"
+ path: "{{ mountpoint }}"
+ fstype: xfs
+ state: mounted