From 0944e7d56af4992bb4ad54269181d1d4083406a7 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 12 Apr 2013 21:47:34 -0400 Subject: [PATCH] Make less template calls on playbook objects. --- lib/ansible/playbook/play.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 6ae9761c2d..bac18e0062 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -65,10 +65,13 @@ class Play(object): self._update_vars_files_for_host(None) - for key in ds: - if key != 'tasks' and key != 'handlers': - # we want to template these later to allow inventory-scope a chance to override - ds[key] = template.template(basedir, ds[key], self.vars) + # template everything to be efficient, but do not pre-mature template + # tasks/handlers as they may have inventory scope overrides + _tasks = ds.pop('tasks', []) + _handlers = ds.pop('handlers', []) + ds = template.template(basedir, ds, self.vars) + ds['tasks'] = _tasks + ds['handlers'] = _handlers self._ds = ds