Score:0

ansible - how to get over "conflicting action statements" error?

de flag

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?

Score:0
in flag

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.

vrms avatar
de flag
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 avatar
de flag
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
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.