# Ansible Tower: sudo task on localhost job failed

**URL:** <https://forum.ansible.com/t/ansible-tower-sudo-task-on-localhost-job-failed/18881>\
**Category:** Ansible Project\
**Created:** [July 29, 2015, 4:18am UTC](https://forum.ansible.com/t/ansible-tower-sudo-task-on-localhost-job-failed/18881 "2015-07-29T04:18:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Do\_Hoang\_Khiem](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@Do\_Hoang\_Khiem](https://forum.ansible.com/u/Do_Hoang_Khiem)\
**Post date:** [July 29, 2015, 4:18am UTC](https://forum.ansible.com/t/ansible-tower-sudo-task-on-localhost-job-failed/18881/1 "2015-07-29T04:18:43Z")

</div>

I’ve deployed an instance of Ansible Tower (using official Ansible EC2 AMI) on one of our server. There’re some of our playbooks that always run locally (so, hosts = localhost, connection = local). Normally those playbooks run fine when run with ansible-playbook from command line but I always got this error when run the same playbook from Ansible Tower job

failed: [localhost] =\> (item=git,ruby,npm,nodejs-legacy) =\> {“failed”: true, “item”: “git,ruby,npm,nodejs-legacy”, “parsed”: false} sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the ‘nosuid’ option set or an NFS file system without root privileges?

the task is a simple apt

- name: “ensure required packages: git, ruby, npm and nodejs-legacy are installed”  
apt: pkg={{item}} state=installed force=yes  
with\_items:
- git
- ruby
- npm
- nodejs-legacy  
sudo: yes

Another thing I don’t know is whether run playbook from Ansible Tower with connection=local like with ansible-playbook? As with ansible-playbook when running on localhost and connection=local I don’t need credentials while with Ansible Tower currently I have to provide credentials (SSH key) for localhost access.

Thanks in advance for any comments!

---

<div class="post-metadata">

**Author:** ![Do\_Hoang\_Khiem](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@Do\_Hoang\_Khiem](https://forum.ansible.com/u/Do_Hoang_Khiem)\
**Post date:** [July 29, 2015, 6:01am UTC](https://forum.ansible.com/t/ansible-tower-sudo-task-on-localhost-job-failed/18881/2 "2015-07-29T06:01:47Z")

</div>

Updated on this:

This problem occurred if I set connection: local in playbook, I often use it when running local playbook from command line, if remove that line the playbook runs successfully from Ansible Tower.

So question: Doesn’t Ansible Tower run playbook with ‘local’ connection? As in the case run local playbook from Ansible Tower I still need to provide credentials.

---

<div class="post-metadata">

**Author:** ![Bill\_Nottingham](https://avatars.discourse-cdn.com/v4/letter/b/3e96dc/32.png) [@Bill\_Nottingham](https://forum.ansible.com/u/Bill_Nottingham)\
**Post date:** [July 29, 2015, 1:43pm UTC](https://forum.ansible.com/t/ansible-tower-sudo-task-on-localhost-job-failed/18881/3 "2015-07-29T13:43:30Z")

</div>

Do Hoang Khiem (dohoangkhiem@gmail.com) said:

> This problem occurred if I set connection: local in playbook, I often use  
> it when running local playbook from command line, if remove that line the  
> playbook runs successfully from Ansible Tower.
> 
> So question: Doesn't Ansible Tower run playbook with 'local' connection? As  
> in the case run local playbook from Ansible Tower I still need to provide  
> credentials.

It has to do with Tower's multi-tenancy support. Hit up support@ansible.com  
(ansible-project is not a Tower support list) and they can help you with it.

Bill
