-   Red Hat (
-   -   Ansible roles - Parted (

wurzel1972 05-12-2020 03:15 PM

Ansible roles - Parted
I am struggling to find any information on creating a Physical volume using parted in a role. I can do it in a playbook but roles always fail with an error code as below:

fatal: []: FAILED! => {"changed": false, "err": "/sbin/parted: invalid token: [lvol]\n", "msg": "Error while running parted script: /sbin/parted -s -m -a optimal /dev/sdb -- unit KiB set 1 [lvol] on", "out": "", "rc": 1}

The line in the task is as follows:
- parted: device=/dev/sdb number=1 label=msdos flags=[lvol] state=present

Please can someone let me know what I am doing wrong.


berndbausch 05-12-2020 06:29 PM

My YAML syntax skills are not that advanced, but the documentation includes an example with spaces around the brackets:

- name: Create a new primary partition for LVM
    device: /dev/sdb
    number: 2
    flags: [ lvm ]
    state: present
    part_start: 1GiB

All times are GMT -5. The time now is 05:35 PM.