Answers: <p>According to <a href="https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html" rel="nofollow noreferrer">https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html</a></p>
  
  <p>it should be <code>remote_user:</code> if it still does not work, run the playbook with <code>-vvvv</code> and add the log to the Q&amp;A.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-12-31T19:58:13.580Z
Answers: 2019-12-31T19:58:13.580Z
Answers: 030
Body: <p>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.</p>
  
  <p>My playbook contains the following</p>
  
  <pre><code>become: yes
  become_method: sudo
  remote_user: remoteuser
  ansible_user: remoteuser
  </code></pre>
  
  <p>ssh.config in my playbook contain the following</p>
  
  <pre><code>match host !proxyA,!proxyB,* exec "ssh proxyA nc -w1 %h %p &amp;&gt;/dev/null
    ProxyJump proxyA
  match host !proxyA,!proxyB,* exec "ssh proxyB nc -w1 %h %p &amp;&gt;/dev/null
    ProxyJump proxyB
  </code></pre>
  
  <p>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</p>
  
  <p>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.</p>
  
  <p>Here is the proxyA/B syslog entries showing the user that AWX is connecting as:</p>
  
  <p>sshd: Failed publickey fro root from 1.2.3.4</p>
  
  <p>And here is the AWX ansible output showing the connection as 'root' instead of the 'remoteuser'</p>
  
  <p>root@proxyA's password: root@proxyA's password:  root@proxyA's password:</p>
  
  <p>I can run the playbook through ansible (outside of AWX) without errors. </p>
  
  <p>How do I tell AWX to use the right user name?</p>
  
Comments: CC BY-SA 4.0
Comments: 2018-10-20T04:53:44.963Z
Comments: You are specifying (or rather not) the user for the proxy in the proxy command. 'ssh user@proxyA -W %h:%p'  ansible specifies the remote user in the connection to the host it jumps to through this proxy. You could try %r as user.
Comments: Jiri Klouda
Comments: CC BY-SA 4.0
Comments: 2018-10-21T03:29:05.073Z
Comments: tried that and still connected as root.  Not sure why, I'll keep looking.  Thanks.
Comments: olveram
Comments: CC BY-SA 4.0
Comments: 2019-12-23T11:48:28.453Z
Comments: Could you indicate whether you solved the issue?
Comments: 030
Comments: CC BY-SA 4.0
Comments: 2019-12-23T11:48:53.580Z
Comments: Is [this](https://devops.stackexchange.com/q/9017/210) related?
Comments: 030
Tags: <ansible><awx>
Title: ansible AWX is connecting through ssh as root instead of user defined in credential
UserDisplayName: olveram
ThreadText: # ansible AWX is connecting through ssh as root instead of user defined in credential
  
  (Asked by: username_0 on 2018-10-20)
  
  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
  
  ```
  become: yes
  become_method: sudo
  remote_user: remoteuser
  ansible_user: remoteuser
  
  ```
  
  ssh.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 proxyB
  
  ```
  
  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?
  
  **Tags:** ansible, awx
  
  > **Comments:**
  > **username_1**: You are specifying (or rather not) the user for the proxy in the proxy command. 'ssh user@proxyA -W %h:%p'  ansible specifies the remote user in the connection to the host it jumps to through this proxy. You could try %r as user.  
  > **username_0**: tried that and still connected as root.  Not sure why, I'll keep looking.  Thanks.  
  > **username_2**: Could you indicate whether you solved the issue?  
  > **username_2**: Is [this](https://devops.stackexchange.com/q/9017/210) related?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-12-31. Score: 1
  
  According to <https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html>
  
  it should be `remote_user:` if it still does not work, run the playbook with `-vvvv` and add the log to the Q&A.
  
  
  ---
  
  