Reize LVM volume with ansible

Short version: how do you resize/extend a logical volume with ansible?

It includes built-in support for managing both physical volumes and volume groups and logical volumes.

Based on the following info from that second link, I’m assuming it’s capable of extending logical volumes:

  1. “This module creates, removes or resizes logical volumes.”
  2. resizefs: Resize the underlying filesystem together with the logical volume.

Plus, the following example in the documentation:

- name: Extend the logical volume to take all remaining space of the PVs and resize the underlying filesystem
    vg: firefly
    lv: test
    size: 100%PVS
    resizefs: true

However, my attempts to resize result in failure. I have these vars defined:

lvm_group: vg00

  - name: /dev/mapper/vg00-lv_home
    size: 5G

and I’m running this task:

- name: configure LVM logical volumes
    vg: "{{ lvm_group }}"
    lv: "{{ }}"
    size: "{{ item.size }}"
    resizefs: yes
   "{{ lvm_volumes }}"

Note: I’ve tried with resizefs set to both yes (as in the documentation) and true (as in the example).

However, I get this failure when running:

failed: ( (item={u'name': u'/dev/mapper/vg00-lv_home', u'size': u'5G'}) => changed=false
  ansible_loop_var: item
  err: |2-
      Logical Volume "lv_home" already exists in volume group "vg00"
    name: /dev/mapper/vg00-lv_home
    size: 5G
  msg: Creating logical volume '/dev/mapper/vg00-lv_home' failed
  rc: 5

Can anyone help me understand what I’m going wrong? Am I missing some other required argument perhaps?

I’m using ansible 2.9.10. Thanks.