images/image-builder/assets/playbooks/roles/qcow/tasks/partitions-and-filesystems.yaml
Craig Anderson caa1cffc0a image-builder for ubuntu based airship hosts
Builds ephemeral ISO and target host images.

Also replaces isogen (iso-builder) with a single ansible-driven build
tool for both types of airship images used: ephemeral ISO as well as
target QCOW2 images deployed to base nodes.

Change-Id: I6d0368de771869e4e645a03d8a20f470b34602ab
2020-12-03 23:16:14 -08:00

28 lines
926 B
YAML

- name: "QCOW | Creating Partitions"
parted:
device: "{{ lookup('file', '/tmp/nbd') }}"
number: "{{ item.0 + 1 }}"
state: present
label: gpt
flags: "{{ item.1.flags | default(omit) }}"
part_start: "{{ item.1.part_start }}"
part_end: "{{ item.1.part_end }}"
name: "{{ item.1.mount | hash('md5') }}"
align: minimal
# For some reason, udev does not honor the partition label for by-partlabel symlinks, so we rename them here
- name: "QCOW | check for symlink"
stat:
path: /dev/disk/by-partlabel/primary
register: symlink
- name: "QCOW | udev symlink rename"
command: mv /dev/disk/by-partlabel/primary /dev/disk/by-partlabel/{{ item.1.mount | hash('md5') }}
when: symlink.stat.exists
- name: "QCOW | Creating Filesystems"
filesystem:
fstype: "{{ item.1.filesystem.type }}"
dev: "/dev/disk/by-partlabel/{{ item.1.mount | hash('md5') }}"
when: item.1.mount != 'none'