fix(roles/exoscale_vm): rewrite on top of v2 HTTP API#253
Open
bhatti-lf wants to merge 1 commit into
Open
Conversation
old cloudstack APIs have been deprecated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The role has been broken for a while: Exoscale deprecated the CloudStack v1 API (changelog) and the
ngine_io.cloudstack.*modules the role used now returnHTTP 403 'This API is deprecated.'.exomade breaking CLI changes on top of that (--private-instancegot replaced by--public-ip none|inet4), and--checkruns were crashing withjson.decoder.JSONDecodeErrorbecause the list task was skipped while the create/deletewhen:still tried tofrom_jsonits empty output.This rewrites the whole thing on top of the v2 HTTP API, via a new small
linuxfabrik.lfops.exoscale_apimodule that signs each request withEXO2-HMAC-SHA256and polls returnedoperationobjects until they leavepending. Signing was cross-checked byte-for-byte against Exoscale's referencerequests-exoscale-auth.ExoscaleV2Auth. Theexobinary andpython3-csare no longer required on the control node.A few things the original role never did, now also wired up:
exoscale_vm__stateactually reacts post-create.started/stopped/restarted/absentmap to:start/:stop/:rebootand theauto-startflag on the create body.fixed_ipand the role calls:update-ipinstead of needing destroy + recreate; remove a network entry and it gets detached.service_offeringanddisk_sizeon existing VMs trigger:scaleand:resize-disk. The role stops the VM first if needed, the existing power-state step starts it back up.--diffshows the method, path and JSON body for every mutating call.There's a new
meta/argument_specs.yml; legacyexoscale_vm__accountis declared but ignored at runtime so existing inventories don't blow up at role entry.A couple of design choices that might warrant a look during review:
ansible.builtin.uri. Keeps the role YAML declarative and the signing logic in one place. Easy to flip ifplugins/modules/shouldn't grow further.module_defaultson the outer block to carry the credentials, instead of repeatingapi_key/api_secret/zoneon every task. No other lfops role seems to use that pattern. Credentials can be inlined per task if that's deliberate.A few API limits to keep in mind, all documented in the README:
:scaleonly allows within-family changes (standard.tinytostandard.large, notstandardtomemory).:resize-diskcan only grow.--checkonly previews top-level mutations cleanly. Nested cascades (rules after the SG is just-created, attach after the instance is just-created,:startafter a:stop-for-scale) have no resource to act on yet, so they silently skip.Tested:
0 changeddisk_size: stops, resizes, restartsservice_offeringwithin family: stops, scales, restartsfixed_ip::update-ipfires:detachfiresstate: 'absent'removes VM and per-VM SG--check --diffpreviews bodies without hitting the API