Hi guys,
I’m trying to connect to some Juniper network devices from AWX.
I’m struggling to understand how to use the Credentials (See image below for the username and ssh key) I’ve set up in AWX to connect to the network devices.
How could I pass the ssh key and username to my playbook? Is it something like this possible after saving the credentials in AWX?
…
…
tasks:
- name: Retrieving full config from devices
juniper_junos_config:
host: ‘{{ inventory_hostname }}’
user: {{ AWX.Credentials.test_key }}
ssh_private_key_file: {{ AWX.Credentials.test_key }}
…
…
At this moment I’m pointing the playbook to look for the key on '~/.ssh/test_key which explains why I get authentication errors (The key doesn’t exists on the container). What I’d like to do is to use the test_key and the username that I’ve defined in the AWX-Credentials area (See image below).
My SSH key is protected with a passphrase so I’m trying as well to pass that passphrase when I select the option “Private key passphrase - Prompt on launch” (I assume this should work and the -k option when running ansible-playbook main.yaml -k) (See image below).
Current Playbook
`