Awx: Fallback instance_id values for inventory imports

Created on 21 Mar 2019  路  5Comments  路  Source: ansible/awx

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
  • API
SUMMARY

Right now, an inventory source type can only have one instance_id value.

This issue is to allow a list of values for instance_id, where it will find the identifier by looking at the first one, and the falling back to the 2nd, 3rd, etc.

ADDITIONAL INFORMATION

The reason is that the inventory plugins have changed the keys for hostvars, including the ones we use for instance_ids.

If we ever allow the YAML inventory config to be customizable (and we should), then we need to anticipate the scenario where we get the instance ID by the new name but not the old name.

Concretely...

| Source | old key | new key |
|----------|---------|-------------|
| ec2 | ec2_id | instance_id |
| gce | gce_id | id |
| azure_rm | id | id |

In https://github.com/ansible/awx/pull/3266, we have a solution to create the old key via the compose options from the old key. That will work for now, but again, we want to allow user customizations. We don't want to constrain them. Solving this issue will allows us to allow the users to remove that variable translation.

So, not urgent, but definitely what we want long-term. Ping @kdelee @wenottingham

api medium enhancement

Most helpful comment

This issue is a little too old.

We did use the compose dictionary to re-create the old values from the new values.

VMWare is only the exception because the value we're looking for is nested in a sub-dictionary, where we decided to axe config.instanceuuid. Also, since the old/new here was a matter of upper/lower case you shouldn't really have both co-existing in hostvars at the same time.

I would just close this issue, I think we had others which were more specifically tracking the error that the patch fixed. I don't expect we need anything else.

All 5 comments

Prototype branch: https://github.com/ansible/awx/compare/devel...AlanCoding:instance_id_fallbacks?expand=1

Alas, I should not say that PR X fixes Issue Y, otherwise Zuul starts taking over.

@AlanCoding I'm reading this issue and trying to figure out if @jladdjr 's patch actually "closes" this issue or just implements it for vmware.

Seems like this issue is more general than that. Would you concur that Jim's patch covers this issue?

If so I would close as verified by regression testing w/ vmware as it is not breaking anything for us and provides flexiblity for either way the variable is specified, which AFAIK depends on version of inventory plugin you might be using.

This issue is a little too old.

We did use the compose dictionary to re-create the old values from the new values.

VMWare is only the exception because the value we're looking for is nested in a sub-dictionary, where we decided to axe config.instanceuuid. Also, since the old/new here was a matter of upper/lower case you shouldn't really have both co-existing in hostvars at the same time.

I would just close this issue, I think we had others which were more specifically tracking the error that the patch fixed. I don't expect we need anything else.

works for me, thanks

Was this page helpful?
0 / 5 - 0 ratings