Create volumes and use all space left

Viewed 141

I want to create volumes in a volume group. To create the second volume I used the size "100%FREE" to take all space left. This worked. But it fails when rerunning this task. Ansible tries to resize the existing volume to size 0 as there is no space left. This is no problem if size is a absolute value like "30g". I'd say this is a bug in the lvol Ansible module. But is there a way to make this work on rerun too?

- name: Create a volume group on top of /dev/vdc
  lvg:
    vg: agent_vg
    pvs: /dev/vdc
    pesize: 64     

- name: Create a logical volume for agent build directory.
  lvol:
    vg: agent_vg
    lv: build_vol
    size: "30g"

- name: Create a logical volume for docker directory.
  lvol:
    vg: agent_vg
    lv: docker_vol
    # TODO: 100%FREE can not be detected on rerun and will cause errors.
    size: "100%FREE"
0 Answers
Related