summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hokka Zakrisson <daniel@hozac.com>2012-11-23 00:31:38 +0100
committerDaniel Hokka Zakrisson <daniel@hozac.com>2012-11-26 22:07:57 +0100
commit1e0295c7e21e5c186d38e3d9898d76568bc0fce3 (patch)
tree18a91e68e172fcc566f8a995c63ed2839faf723c
parentebd31af940a72265a851d67ecc9b5b88e146a1ca (diff)
downloadansible-1e0295c7e21e5c186d38e3d9898d76568bc0fce3.tar.gz
Template handlers late
This allows overriding variables in name, and removes templating from parsing.
-rw-r--r--lib/ansible/playbook/__init__.py8
-rw-r--r--lib/ansible/playbook/task.py3
2 files changed, 4 insertions, 7 deletions
diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py
index 8af8412474..314492e7be 100644
--- a/lib/ansible/playbook/__init__.py
+++ b/lib/ansible/playbook/__init__.py
@@ -308,13 +308,13 @@ class PlayBook(object):
for host, results in results.get('contacted',{}).iteritems():
if results.get('changed', False):
for handler_name in task.notify:
- self._flag_handler(play.handlers(), utils.template(play.basedir, handler_name, task.module_vars), host)
+ self._flag_handler(play, utils.template(play.basedir, handler_name, task.module_vars), host)
return hosts_remaining
# *****************************************************
- def _flag_handler(self, handlers, handler_name, host):
+ def _flag_handler(self, play, handler_name, host):
'''
if a task has any notify elements, flag handlers for run
at end of execution cycle for hosts that have indicated
@@ -322,8 +322,8 @@ class PlayBook(object):
'''
found = False
- for x in handlers:
- if handler_name == x.name:
+ for x in play.handlers():
+ if handler_name == utils.template(play.basedir, x.name, x.module_vars):
found = True
self.callbacks.on_notify(host, x.name)
x.notified_by.append(host)
diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py
index 956c9eaee0..534ea058a3 100644
--- a/lib/ansible/playbook/task.py
+++ b/lib/ansible/playbook/task.py
@@ -149,9 +149,6 @@ class Task(object):
# allow the user to list comma delimited tags
import_tags = import_tags.split(",")
- self.name = utils.template(None, self.name, self.module_vars)
- self.action = utils.template(None, self.action, self.module_vars)
-
# handle mutually incompatible options
incompatibles = [ x for x in [ self.first_available_file, self.items_lookup_plugin ] if x is not None ]
if len(incompatibles) > 1: