From fffb1a0a9d4d620336801aee7e1e72bc3b862af8 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sat, 6 Apr 2013 18:36:25 -0400 Subject: [PATCH] Loose tasks not in roles get executed after roles. --- examples/playbooks/roletest.yml | 7 +++++++ lib/ansible/playbook/play.py | 13 ++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/examples/playbooks/roletest.yml b/examples/playbooks/roletest.yml index ec9c9886c3..9a7cede6a6 100644 --- a/examples/playbooks/roletest.yml +++ b/examples/playbooks/roletest.yml @@ -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' + + diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 567158633a..f46e6ad4b0 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -166,13 +166,12 @@ class Play(object): 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