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

https://github.com/ansible/ansible/pull/10566

On Thu, Apr 2, 2015 at 1:11 PM, Greg Peterson <[email protected]>
wrote:

> 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*
> ---
> - { include: packages.yml, sudo: True, tags: ['packages'] }
>
> *packages.yml (1)*
> ---
> - name: apt packages | update cache
>   apt:
>     update_cache: True
>     cache_valid_time: 600
>
> *packages.yml (2)*
> ---
> - name: apt packages | update cache
>   sudo: True
>   apt:
>     update_cache: True
>     cache_valid_time: 600
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/6ab38fcf-c5fc-4f0c-ad6a-549953b6eae7%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/6ab38fcf-c5fc-4f0c-ad6a-549953b6eae7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v85FHx_xwv30_kNJcKP3BA-VSLvF8%3D_yWyTwQB5PN4qGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to