# How to switch the local connection user from root to another user

**URL:** <https://forum.ansible.com/t/how-to-switch-the-local-connection-user-from-root-to-another-user/26160>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [November 28, 2017, 10:21pm UTC](https://forum.ansible.com/t/how-to-switch-the-local-connection-user-from-root-to-another-user/26160 "2017-11-28T22:21:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tchia04](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@Tchia04](https://forum.ansible.com/u/Tchia04)\
**Post date:** [November 28, 2017, 10:21pm UTC](https://forum.ansible.com/t/how-to-switch-the-local-connection-user-from-root-to-another-user/26160/1 "2017-11-28T22:21:42Z")

</div>

Here is my playbook

# test.yml

- name: localhost\_test  
hosts: localhost  
gather\_facts: false

tasks:

- name: Run ls  
shell: ls  
register: ls\_result

I am using a local ansible.cfg with this setting

remote\_user = tchia

when I run this on the command line, I can see it’s using my user name  
ansible-playbook -vvvv -i ./inventory test.yml

Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py  
 ESTABLISH LOCAL CONNECTION FOR USER: tchia  
 EXEC /bin/sh -c ‘echo ~ && sleep 0’

However when run the same playbook through AWX, it’s not picking my my remote\_user setting even though the awx log file show it’s using my ansible.cfg

ansible-playbook 2.4.1.0

2  
config file = /var/lib/awx/projects/perforce\_test/ansible.cfg

3  
configured module search path = [u’/var/lib/awx/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]

…4

…

Using module\_utils file /usr/lib/python2.7/site-packages/ansible/module\_utils/pycompat24.py

28  
Using module\_utils file /usr/lib/python2.7/site-packages/ansible/module\_utils/six/ **init**.py

29  
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py

30  
\<127.0.0.1\> ESTABLISH LOCAL CONNECTION FOR USER: root

31  
\<127.0.0.1\> EXEC /bin/sh -c ‘echo ~ && sleep 0’

32

---

<div class="post-metadata">

**Author:** ![matburt](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/matburt/32/3612_2.png) [@matburt](https://forum.ansible.com/u/matburt)\
**Post date:** [November 29, 2017, 12:58pm UTC](https://forum.ansible.com/t/how-to-switch-the-local-connection-user-from-root-to-another-user/26160/2 "2017-11-29T12:58:25Z")

</div>

Did you try “ansible\_user” ?

using “become” is another option which is probably more in line with what you want.
