# Lost in user permissions and playbooks

**URL:** <https://forum.ansible.com/t/lost-in-user-permissions-and-playbooks/11685>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [July 16, 2012, 11:54am UTC](https://forum.ansible.com/t/lost-in-user-permissions-and-playbooks/11685 "2012-07-16T11:54:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [July 16, 2012, 11:54am UTC](https://forum.ansible.com/t/lost-in-user-permissions-and-playbooks/11685/1 "2012-07-16T11:54:47Z")

</div>

You have a typo. The key in the playbook is "sudo\_user", not "sudo-user".

So, basically bad input, and it's just using defaults.

(In thinking of how to prevent this in the future, it's probably time to have play books whine about unknown keys, seeing if you want to add a comment YAML supports "#" just fine. Also the banner for a play should probably include more info, like what hosts it is running on, and what user and sudo user it is using. This is all pretty easy to do, so this is a useful reminder to do those things!)

--Michael

---

<div class="post-metadata">

**Author:** ![ludovicc](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@ludovicc](https://forum.ansible.com/u/ludovicc)\
**Post date:** [July 16, 2012, 12:23pm UTC](https://forum.ansible.com/t/lost-in-user-permissions-and-playbooks/11685/2 "2012-07-16T12:23:17Z")

</div>

Thanks Michael,

My playbook is now working. I’m using:

- name: deploy on Integration  
hosts: int  
sudo\_user: webjava  
sudo: True  
gather\_facts: False

vars\_files:

- tomcat/vars/locations.yml

tasks:

- name: backup Tomcat configuration  
action: file path=${backup\_home}/before\_${jaw\_version} state=directory owner=webjava group=webjava mode=0751

Two remarks:

- sudo cannot be applied on a particular task, you have to apply it at the playbook level. If you have tasks that run at the user level, then tasks running with sudo, you need two plays in your playbook.
- there is no documentation for the sudo\_user key in a playbook (check [http://ansible.github.com/playbooks.html#hosts-and-users](http://ansible.github.com/playbooks.html#hosts-and-users)),

Thanks,  
Ludovic
