Skip to content

Commit

Permalink
Loose tasks not in roles get executed after roles.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael DeHaan committed Apr 6, 2013
1 parent f044fc3 commit fffb1a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 7 additions & 0 deletions examples/playbooks/roletest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@
# explicit tasks and handlers can be used, but are not required.
# they will run after the roles if present.

tasks:

# you can still have loose tasks/handlers and they will execute after roles

- shell: echo 'this is a loose task'


13 changes: 6 additions & 7 deletions lib/ansible/playbook/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,12 @@ def _load_roles(self, roles, ds):
handlers = []
if type(vars_files) != list:
vars_files = []
tasks.extend(new_tasks)
handlers.extend(new_handlers)

vars_files.extend(new_vars_files)
ds['tasks'] = tasks
ds['handlers'] = handlers
ds['vars_files'] = vars_files
new_tasks.extend(tasks)
new_handlers.extend(handlers)
new_vars_files.extend(vars_files)
ds['tasks'] = new_tasks
ds['handlers'] = new_handlers
ds['vars_files'] = new_vars_files

return ds

Expand Down

0 comments on commit fffb1a0

Please sign in to comment.