# Ansible 1.9 Using Sudo on an Include?

**URL:** <https://forum.ansible.com/t/ansible-1-9-using-sudo-on-an-include/17893>\
**Category:** Ansible Project\
**Created:** [April 2, 2015, 6:11pm UTC](https://forum.ansible.com/t/ansible-1-9-using-sudo-on-an-include/17893 "2015-04-02T18:11:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg\_Peterson](https://avatars.discourse-cdn.com/v4/letter/g/48db29/32.png) [@Greg\_Peterson](https://forum.ansible.com/u/Greg_Peterson)\
**Post date:** [April 2, 2015, 6:11pm UTC](https://forum.ansible.com/t/ansible-1-9-using-sudo-on-an-include/17893/1 "2015-04-02T18:11:02Z")

</div>

Didn’t see anything mentioned in changes notes for 1.9 about changing the way sudo worked with includes, so wanted to post this:

In the below example, sudo is no longer seeming to apply to the tasks in the included file . If I attach “sudo: True” directly to the task then the playbook runs, see second example.

First example works fine in 1.8.4, but 1.9.0.1 the playbooks/roles break:

TASK: [sts-base-system | apt packages | update cache] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [10.0.50.50] =\> {“failed”: true}  
msg: Failed to lock apt for exclusive operation

FATAL: all hosts have already failed – aborting

Can workaround by updating all playbooks and roles to apply sudo directly to each task, but pretty inconvenient.

**main.yml**

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [April 2, 2015, 7:38pm UTC](https://forum.ansible.com/t/ansible-1-9-using-sudo-on-an-include/17893/2 "2015-04-02T19:38:42Z")

</div>

You will likely be interested in a fix that was applied to devel a short time ago:

[https://github.com/ansible/ansible/pull/10566](https://github.com/ansible/ansible/pull/10566)
