0

I have an Ansible playbook for creating and resizing logical Volumes

# playbook lvol.yml
- hosts: step
  tasks:
  - name: 'create /dev/sdb1 -> 20GB (of 35GB)'
    community.general.parted:
    device: /dev/sdb
    number: 1
    state: present
#    fs_type: ext4


  - name: "resize vgsys by /dev/sdb1"
    community.general.lvg:
    vg: vgsys
    pvs: /dev/sdb1

  - name: "extend lv 'name' to 10GB from /dev/sdb (35GB)"
    community.general.lvol:
      vg: vgsys
      lv: name
      size: 10g

The yaml syntax seems to be good (checked with onlineyamltools.com) but I am getting this error on execution:

ERROR! conflicting action statements: community.general.parted, device

The error appears to be in '/path/to/lvol.yml': line 4, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
  - name: 'create /dev/sdb1 -> 20GB (of 35GB)'
    ^ here

if I comment out the first (community.general.parted) task the same error appears for the second (lvol) task.

can anybody kindly point me to the right direction on how to get over this?

Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79
vrms
  • 227
  • 4
  • 16

1 Answers1

0

Your yaml is not indendet properly.

You need to indent the parameters to a module one level further:

- hosts: step
  tasks:
  - name: 'create /dev/sdb1 -> 20GB (of 35GB)'
    community.general.parted:
      device: /dev/sdb
      number: 1
      state: present
  #    fs_type: ext4

  - name: "resize vgsys by /dev/sdb1"
    community.general.lvg:
      vg: vgsys
      pvs: /dev/sdb1

Your task with the lvol module is already correct.

The online validator can't detect that because it can only check for syntactically correct yaml, not for functional correct keys and values.

Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79
  • sorry, newby mistake ... thx for the pointer. I am getting errors still when I use the 'FQDN' (like `community.general.parted`) for the modules (contradicting the advice I saw on this. It works when referring to the simple name (`parted`) – vrms Oct 06 '21 at 10:31
  • the issue with the naming of the module mentioned above probably is due to the version (2.9) I am running on a rhel83 machine – vrms Oct 06 '21 at 18:54