LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Ansible roles - Parted (https://www.linuxquestions.org/questions/red-hat-31/ansible-roles-parted-4175675098/)

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: [server3.example.com]: 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.

Regards,
Dave

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:
Code:

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



All times are GMT -5. The time now is 11:15 PM.