`volume_size_gb` only works when creating a new VM but gets ignored afterwards
Closed this issue · 2 comments
volume_size_gb
does not update the size of the root-disk, when changed in ansible:
---
- name: Using cloudscale.ch collection
hosts: localhost
collections:
- cloudscale_ch.cloud
tasks:
- server:
name: test1
image: debian-12
flavor: flex-4-1
ssh_keys:
- ssh-rsa notrelevant
zone: lpg1
api_token: secret
- server:
name: test1
image: debian-12
flavor: flex-4-1
volume_size_gb: 20
ssh_keys:
- ssh-rsa notrelevant
zone: lpg1
api_token: secret
Output:
PLAY [Using cloudscale.ch collection] ******************************************************************************
TASK [server] ******************************************************************************************************
changed: [localhost]
TASK [server] ******************************************************************************************************
ok: [localhost]
PLAY RECAP *********************************************************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
I would expect this to scale the root disk to 20G. Also, the Module doesn't fail if I specify something smaller than deployed in Ansible, which led to confusion on our side in the past.
Thanks for your issue. I'll make sure we tackle this in our next sprint. I agree that this seems buggy.
I agree that this behavior is not ideal. Every cloudscale_ch ansible module is used to access one API endpoint and changing the size of the root volume is not supported by the server endpoint.
We are currently working on new volume API endpoints and have no plans to change the behavior of volume_size_gb
, which predates the introduction of /v1/volumes
.
To make the root volume size configurable you could use this playbook:
---
- name: create server
hosts: localhost
collections:
- cloudscale_ch.cloud
vars:
name: servername
size: 25 # you can only increase this value
tasks:
- name: Start cloudscale_ch server
server:
name: "{{ name }}"
image: debian-12
flavor: flex-4-1
volume_size_gb: "{{ size }}"
- name: Change volume size
volume:
name: "{{ name }}-root"
size_gb: "{{ size }}"
I'm not sure if it would be better if the first task would print a warning if size
is bigger or fail if size
is smaller than the current size.
I created a PR to explicitly state in the documentation that this is not possible.