best practice for linking/attachment of cloud resources

8 views
Skip to first unread message

Tomas Karasek

unread,
Feb 13, 2023, 10:10:04 AM2/13/23
to Ansible Development
Hi, I'm working on a collection for a cloud infrastructure provider. I'm now thinking about how to implement assigning a "floating" IP address to a server.

I have a module for the server, and will probably have a module for the floating_ip. I can add a field to the server ("assigned_ips") and pass the ID of the floating IP to it on creation and update. The construction is straightforward, but the deletion is unclear - what should happen when the assigned IP is deleted? There may be side effects to unlinking, and I foresee other issues that will become apparent later in development.

Is there a best practice for this in Ansible? I've looked at google.cloud and linode.cloud but haven't really found a good use case of such linking. It almost seemed as if the authors were avoiding such functionality in the collections. I would appreciate it if someone can come up with an example module in a collection.

In Terraform, there's clear best practice for this: there's a special "module" ending with _attachment (for example [0]) that manages the lifecycle of the association, in this case between device and an ip address.

Thanks for reading my question.

Best Regards,
Tomas Karasek

Reply all
Reply to author
Forward
0 new messages