patternMinor
ansible AWX is connecting through ssh as root instead of user defined in credential
Viewed 0 times
awxcredentialconnectinguserinsteadrootthroughsshansibledefined
Problem
I'm running ansible 2.6.2 and awx 1.0.7.2 on rhel 7.5. AWX is connecting to my ssh proxy as root instead of the defined Credential user.
My playbook contains the following
ssh.config in my playbook contain the following
My AWX credential user which uses an ssh key and associated with the AWX JOB Template is this (which should be used for ssh connections): remoteuser
I have no defined entries in /etc/ansible/ansible.cfg or any ansible.cfg defined in the current working directory (of the playbook) or in $HOME.
Here is the proxyA/B syslog entries showing the user that AWX is connecting as:
sshd: Failed publickey fro root from 1.2.3.4
And here is the AWX ansible output showing the connection as 'root' instead of the 'remoteuser'
root@proxyA's password: root@proxyA's password: root@proxyA's password:
I can run the playbook through ansible (outside of AWX) without errors.
How do I tell AWX to use the right user name?
My playbook contains the following
become: yes
become_method: sudo
remote_user: remoteuser
ansible_user: remoteuserssh.config in my playbook contain the following
match host !proxyA,!proxyB,* exec "ssh proxyA nc -w1 %h %p &>/dev/null
ProxyJump proxyA
match host !proxyA,!proxyB,* exec "ssh proxyB nc -w1 %h %p &>/dev/null
ProxyJump proxyBMy AWX credential user which uses an ssh key and associated with the AWX JOB Template is this (which should be used for ssh connections): remoteuser
I have no defined entries in /etc/ansible/ansible.cfg or any ansible.cfg defined in the current working directory (of the playbook) or in $HOME.
Here is the proxyA/B syslog entries showing the user that AWX is connecting as:
sshd: Failed publickey fro root from 1.2.3.4
And here is the AWX ansible output showing the connection as 'root' instead of the 'remoteuser'
root@proxyA's password: root@proxyA's password: root@proxyA's password:
I can run the playbook through ansible (outside of AWX) without errors.
How do I tell AWX to use the right user name?
Solution
According to https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html
it should be
it should be
remote_user: if it still does not work, run the playbook with -vvvv and add the log to the Q&A.Context
StackExchange DevOps Q#5220, answer score: 1
Revisions (0)
No revisions yet.