Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

volume_size_gb only works when creating a new VM but gets ignored afterwards #103

Closed
ombre8 opened this issue Oct 16, 2024 · 2 comments · Fixed by #104
Closed

volume_size_gb only works when creating a new VM but gets ignored afterwards #103

ombre8 opened this issue Oct 16, 2024 · 2 comments · Fixed by #104

Comments

@ombre8
Copy link

ombre8 commented Oct 16, 2024

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.

@href
Copy link
Contributor

href commented Oct 17, 2024

Thanks for your issue. I'll make sure we tackle this in our next sprint. I agree that this seems buggy.

@ctx ctx linked a pull request Nov 1, 2024 that will close this issue
@ctx
Copy link
Contributor

ctx commented Nov 7, 2024

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.

@ctx ctx closed this as completed in #104 Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants