ngine-io / ansible-collection-cloudstack

CloudStack Ansible Collections
https://galaxy.ansible.com/ngine_io/cloudstack
GNU General Public License v3.0
21 stars 27 forks source link

[question] cs_instance domain id & network vpc id #89

Closed livegrenier closed 2 years ago

livegrenier commented 2 years ago

Hey,

From my testing i have noticed we cannot use a standard (non admin) account due to the "list domain" limitations of a non admin user.

I had also noticed that since the VPC is not specified for cs_instance it is a bit of a problem if we have multiple VPC with the same network names in the same project.

Is there a workaround? if not would you be open if i propose a PR to change the domain name to a domain id and add a vpc id in cs_instance? we would probably have fewer issues if we used ID's overall and not names, let me know what you think.

Thanks.

resmo commented 2 years ago

Hi @livegrenier

Using "names" was a design descision because, it is the human identifiier, it is something as user you define and should be foundable later.

With UUIDs (IDs) as a user, you can not know it in advance. So you have to create the resource first to get the ID, note it down and use it later. This would not match our workflow.

However, in many resources, you could either use IDs or names e.g. for cs_instance, you could also use the ID to find the VM https://github.com/ngine-io/ansible-collection-cloudstack/blob/master/plugins/modules/cs_instance.py#L545 for e.g. reboot or stopping it.

So the question I have is, why would you want to use a different domain as a user then your own, is this even "possible" API wise? Could you explain the use case a bit more in detail? Did you note, that domain is optional to use your own domain?

I see, we don't have a vpc argument in cs_instance. I would be open to add a vpc argument to cs_instance,

livegrenier commented 2 years ago

Hi @resmo,

Turns out the the issue i had was that i was using an admin account and when i removed domain from the arguments it was not able to find the project, using a standard account and removing the domain argument worked fined.

I will see what i can do to add a VPC option and open a PR when i am ready.

Thank you for your time.

Regards.