Newbie - how to associate a credential with a inventory host?

Hello

I’m new to Awx, so please excuse my lack of knowledge.

I have an inventory, which has one remote host.
To access this remote host I use a ssh username and password. I have this added to credentials.

My question is, how can I associate the credentials entry with the inventory host?

Thanks

Hi

I got the following reply directly:

You attach that through with job template

You create a job template and associate the credential from there

However, the problem with this is, an Inventory can have one or more hosts. Each host can have a unique credentials (not the same credentials for every host).

While a job can have more than one credentials, there doesnt seem to be any awx mechanism to associate credentials with a host.

That’s correct. This is a very difficult problem to solve… it’s somewhat fine if they have different ssh keys but if each host has a different password (for example) then we have no way to respond to the prompts. We’re looking to solve this in different ways down the road a little bit but in the meantime you’ll have to deal with a single credential for a run.

Hi Mathew

Thanks for the reply.

Perhaps, as a temporary step forward, do not support prompts in this case?

Possibly, but we probably aren’t going to attempt to address this in any way in the short term.

Understood.

Is there any recommended solution/workaround for users who have an inventory with multiple hosts (each with a unique username/password)?

Put ansible_ssh_username and ansible_ssh_password into the extra vars for each host (or group or whatever).

Hi Matthew,

I face the same issue as Anton.

I noticed you said in your post " … it’s somewhat fine if they have different ssh keys …". Can I specify a variable at the Host definition level to select a pre-defined Machine > SSH Credential? I have common user names but differing SSH keys.

Thanks and regards…Paul

Unfortunately no, my statement of “it’s somewhat fine” means we could probably design a solution around that but we haven’t yet.

Hi Mathew

Is there any documentation for a workaround? I didnt understand what you meant by: