#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