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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to