controller_configuration icon indicating copy to clipboard operation
controller_configuration copied to clipboard

Use ID instead of object name

Open lovegronvall opened this issue 2 years ago • 1 comments

I would like to be able to use the ID instead of name. Maybe in general, but in my case it breaks when I use redhat_cop.controller_configuration.hosts

I try to configure the controller host with the inventory "Localhost". There are two different Localhost inventories in different organizations. redhat_cop.controller_configuration.hosts returns an error: "msg": "Request to /api/v2/inventories/?name=Localhost returned 2 items, expected 1",

I would like to specify which inventory by ID rather than by the commonly used name which can be duplicates and generate errors.

lovegronvall avatar Oct 05 '22 14:10 lovegronvall

So this is an issue with the underlying module, did you specify an organization the inventory belonged to, as it is used as a lookup helper to narrow down which inventory you are looking for.

We highly recommend to NOT use IDs though. As they are dependent on the specific installation, if you choose to move to a new instance of Automation controller, that ID can change, the modules are built to lookup by name, with organization helpers, as each should be unique inside an org.

sean-m-sullivan avatar Oct 05 '22 14:10 sean-m-sullivan

As far as I understand, it's not possible to specifiy which organization the inventory belongs to? This would very much be optimal in my use case, much like the "lookup_organization" variable in the roles role.

lovegronvall avatar Oct 14 '22 11:10 lovegronvall

as Sean said we are limited to the underlying modules limitations. I would suggest going to the awx.awx collection repo and reporting the issue there and see if they are willing to add other options to help solve the issue. IMO I would just create a localhost_ORGname to have them not use the same inventory name, this is how I have done it in the past.

djdanielsson avatar Oct 14 '22 13:10 djdanielsson

Okay, I see. Thanks for looking into the issue, guys!

lovegronvall avatar Oct 14 '22 15:10 lovegronvall