salt-extensions / saltext-proxmox

Salt Extension modules for Proxmox VE
https://salt-extensions.github.io/saltext-proxmox/
Apache License 2.0
16 stars 7 forks source link

[FEATURE REQUEST] Determine idempotence requirements #11

Open mthibaut opened 1 year ago

mthibaut commented 1 year ago

Decide on semantics

Describe the solution you'd like Unsure.

Additional context Calling salt-cloud -p myprofile myguest fails if myguest exists. Is this expected behavior?

I3urny commented 1 year ago

I don't think that salt-cloud in general or rather cloud providers should be idempotent. What should be idempotent is the use of the Cloud Map File in salt-cloud.

Cloud maps let you define a map of your infrastructure and quickly provision any number of VMs. On subsequent runs, any VMs that do not exist are created, and VMs that are already configured are left unmodified.

I did not find such a definition anywhere for the creation of VMs via salt-cloud -p.

So my answers to your questions are:

  1. No, proxmox.py should not be idempotent. Idempotence is handled through Cloud map files.
  2. Yes, trying to create a new machine that already exists via salt-cloud -p should fail.
  3. Yes, trying to create a new machine with an already existing VM ID via salt-cloud -p should fail.
nicholasmhughes commented 12 months ago

True idempotence likely won't be achieved in the cloud module without changes to the underlying salt-cloud code. Currently, salt-cloud will create any instances where the name is not found in the cloud. If the name is found, it will not be created. If the configuration is changed for a given instance, the instance will need to be destroyed and created again for the change to take effect. Instance configuration cannot be enforced with salt-cloud.

That said, there's no reason that we can't create execution and state modules for idempotent creation and maintenance of cloud instances. There was a push toward this in a recent release of the Azure Extension.