# Can´t execute tasks as sudo

**URL:** <https://forum.ansible.com/t/can-t-execute-tasks-as-sudo/31113>\
**Category:** AWX Project\
**Created:** [August 23, 2019, 4:17pm UTC](https://forum.ansible.com/t/can-t-execute-tasks-as-sudo/31113 "2019-08-23T16:17:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andre\_Trindade](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Andre\_Trindade](https://forum.ansible.com/u/Andre_Trindade)\
**Post date:** [August 23, 2019, 4:17pm UTC](https://forum.ansible.com/t/can-t-execute-tasks-as-sudo/31113/1 "2019-08-23T16:17:49Z")

</div>

Good afternoon.

I am trying to execute tasks with sudo but i am getting troubles, i don´t have root access.

I enabled privilege escalation in the jobs and set the sudo password and user name but nothing, does not work.

PS: The user has sudo privileges.

Anyone can help me?

Thank you.

 ![](https://us1.discourse-cdn.com/ansible/original/2X/e/eb1c7c0411c4cb18ba78937e2cc6eedcd3f6656e.png) ![](https://us1.discourse-cdn.com/ansible/original/2X/f/f2fab1937eda82029fdccbd6971f1372c85d9a8a.png)

---

<div class="post-metadata">

**Author:** ![Micah\_Joiner](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Micah\_Joiner](https://forum.ansible.com/u/Micah_Joiner)\
**Post date:** [August 23, 2019, 4:19pm UTC](https://forum.ansible.com/t/can-t-execute-tasks-as-sudo/31113/2 "2019-08-23T16:19:39Z")

</div>

become needs to be set to true not yes

become: true

> **(attachments)**
>
> ![Auto Generated Inline Image 1.png](https://us1.discourse-cdn.com/ansible/original/2X/e/eb1c7c0411c4cb18ba78937e2cc6eedcd3f6656e.png)  
> ![Auto Generated Inline Image 2.png](https://us1.discourse-cdn.com/ansible/original/2X/f/f2fab1937eda82029fdccbd6971f1372c85d9a8a.png)

---

<div class="post-metadata">

**Author:** ![Andre\_Trindade](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Andre\_Trindade](https://forum.ansible.com/u/Andre_Trindade)\
**Post date:** [August 23, 2019, 4:30pm UTC](https://forum.ansible.com/t/can-t-execute-tasks-as-sudo/31113/3 "2019-08-23T16:30:36Z")

</div>

Hi Micah

Thank you for helping me, but that is not the problem, look like the “yes” and “true” are equal, as fact in ansible documentation they use yes instead true.

Thank you

sexta-feira, 23 de Agosto de 2019 às 17:19:53 UTC+1, Micah escreveu:

---

<div class="post-metadata">

**Author:** ![Andre\_Trindade](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Andre\_Trindade](https://forum.ansible.com/u/Andre_Trindade)\
**Post date:** [August 26, 2019, 10:27am UTC](https://forum.ansible.com/t/can-t-execute-tasks-as-sudo/31113/4 "2019-08-26T10:27:44Z")

</div>

Can anyone execute tasks as sudo on AWX?

---

<div class="post-metadata">

**Author:** ![Andre\_Trindade](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Andre\_Trindade](https://forum.ansible.com/u/Andre_Trindade)\
**Post date:** [August 26, 2019, 11:58am UTC](https://forum.ansible.com/t/can-t-execute-tasks-as-sudo/31113/5 "2019-08-26T11:58:50Z")

</div>

SSH LOGS: osboxes sudo: pam\_unix(sudo:session): session opened for user root by

The session was opened as root but the task was not executed as sudo.

---

<div class="post-metadata">

**Author:** ![Andre\_Trindade](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Andre\_Trindade](https://forum.ansible.com/u/Andre_Trindade)\
**Post date:** [August 27, 2019, 3:30pm UTC](https://forum.ansible.com/t/can-t-execute-tasks-as-sudo/31113/6 "2019-08-27T15:30:31Z")

</div>

Good afternoon.

For reference the issue is that i was trying to escalate for my user. I removed my username from “Privilege Escalation Username” and now it´s working. Thanks.

sexta-feira, 23 de Agosto de 2019 às 17:17:49 UTC+1, André Trindade escreveu:
