# Issue with Ansible user and sudo user

**URL:** <https://forum.ansible.com/t/issue-with-ansible-user-and-sudo-user/14454>\
**Category:** Ansible Project\
**Tags:** fedora\
**Created:** [January 29, 2014, 8:46pm UTC](https://forum.ansible.com/t/issue-with-ansible-user-and-sudo-user/14454 "2014-01-29T20:46:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emmanuel\_Pinault](https://avatars.discourse-cdn.com/v4/letter/e/82dd89/32.png) [@Emmanuel\_Pinault](https://forum.ansible.com/u/Emmanuel_Pinault)\
**Post date:** [January 29, 2014, 8:46pm UTC](https://forum.ansible.com/t/issue-with-ansible-user-and-sudo-user/14454/1 "2014-01-29T20:46:53Z")

</div>

I am trying to deploy on Fedora 18 (target) from my Mac with ansible version 1.4.3

I am trying to the following command where my ssh user is also my sudo user

ansible-playbook -i hosts ctas\_install.yml -u preseed -K -U preseed -vvv

but I never ever see the command being executed as sudo in the debug… And it fails (trying to install simple package git)

192.168.222.131\> ESTABLISH CONNECTION FOR USER: preseed

\<192.168.222.131\> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/Emmanuel/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=preseed’, ‘-o’, ‘ConnectTimeout=10’, ‘192.168.222.131’, “/bin/sh -c ‘mkdir -p /tmp/ansible-1391028097.46-71967857175139 && chmod a+rx /tmp/ansible-1391028097.46-71967857175139 && echo /tmp/ansible-1391028097.46-71967857175139’”]

\<192.168.222.131\> REMOTE\_MODULE yum pkg=git state=latest

\<192.168.222.131\> PUT /var/folders/p3/05g7th9x4vzf\_198t01mdtcr0000gp/T/tmp446O71 TO /tmp/ansible-1391028097.46-71967857175139/yum

\<192.168.222.131\> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/Emmanuel/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=preseed’, ‘-o’, ‘ConnectTimeout=10’, ‘192.168.222.131’, “/bin/sh -c ‘chmod a+r /tmp/ansible-1391028097.46-71967857175139/yum’”]

\<192.168.222.131\> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/Emmanuel/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=preseed’, ‘-o’, ‘ConnectTimeout=10’, ‘192.168.222.131’, “/bin/sh -c ‘/usr/bin/python -tt /tmp/ansible-1391028097.46-71967857175139/yum’”]

\<192.168.222.131\> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/Emmanuel/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=preseed’, ‘-o’, ‘ConnectTimeout=10’, ‘192.168.222.131’, “/bin/sh -c ‘rm -rf /tmp/ansible-1391028097.46-71967857175139/ \>/dev/null 2\>&1’”]

failed: [192.168.222.131] =\> {“changed”: false, “failed”: true, “item”: “”, “rc”: 1, “results”: [“Loaded plugins: langpacks, presto\n”]}

msg: You need to be root to perform this command.

But if execute without the -U , it tries as root and hangs…

what am I doing wrong?

Any idea

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [January 30, 2014, 1:45am UTC](https://forum.ansible.com/t/issue-with-ansible-user-and-sudo-user/14454/2 "2014-01-30T01:45:31Z")

</div>

you are trying to sudo from a user to himself? (preseed in both cases)

---

<div class="post-metadata">

**Author:** ![Emmanuel\_Pinault](https://avatars.discourse-cdn.com/v4/letter/e/82dd89/32.png) [@Emmanuel\_Pinault](https://forum.ansible.com/u/Emmanuel_Pinault)\
**Post date:** [January 30, 2014, 2:25am UTC](https://forum.ansible.com/t/issue-with-ansible-user-and-sudo-user/14454/3 "2014-01-30T02:25:19Z")

</div>

I guess I was confused with what it meant. I was trying to specify who has sudo access , instead of what user is being run as sudo. I think I sorted out my problem. Aslo the hang was due to some proxy issue
