Ansible - extending container disk

czidlo

New Member
Aug 20, 2024
1
1
3
Hello,
I am trying to extend container disk by ansible proxmox module. I can create container, change cpus, memory etc., but I have problem with changing disk size.
In GUI Resources of the container i can see Root Disk: local-lvm:vm-107-disk-0,size=25G

Code:
- name: Update container settings
        community.general.proxmox:
          hostname: "{{ ct_config.name }}"
          node: "{{ final_pve_node }}"
          vmid: "{{ container_check.vmid }}"
          api_host: "{{ final_pve_node }}"
          api_user: "{{ pve_api_user }}"
          api_token_id: '{{ pve_api_token_id }}'
          api_token_secret: "{{ final_pve_api_token_secret }}"
          ostype: "{{ pve_ostype }}"
          cores: "{{ ct_config.cores }}"
          cpus: "{{ ct_config.cpus }}"
          memory: "{{ ct_config.memory }}"
          swap: "{{ ct_config.swap }}"
          netif: '{"net0":"name=eth0,gw={{ ct_config.gw }},ip={{ ct_config.ip }},bridge=vmbr0"}'
          disk_volume:
            storage: "{{ pve_storage }}"
            volume: "vm-{{ container_check.vmid }}-disk-0"
            size: "{{ ct_config.disk_size }}"
          state: present
          update: true

I tried both disk and disk_volume parameters to change it:
Code:
disk: local-lvm:vm-107-disk-0,size=27G"

Code:
disk_volume:
            storage: "local-lvm"
            volume: "vm-107-disk-0"
            size: 27

After running playbook, I can see this
1724158948395.png
Tried reboot of container and then I see the right size local-lvm:vm-107-disk-0,size=27G.
But inside container there are no changes
Code:
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/pve-vm--107--disk--0   25G  603M   23G   3% /

on PVE host there is also no changes:
Code:
Disk /dev/mapper/pve-vm--107--disk--0: 25 GiB, 26843545600 bytes, 52428800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes

Tried also the old syntax:
disk: local-lvm:27

Does anybody know what can be the problem or if this can be a bug ?
Thanks

Using: Proxmox 8.2.4
 

Attachments

  • 1724157644549.png
    1724157644549.png
    32.2 KB · Views: 0
  • Like
Reactions: jory