From 0be1f11ed5e1582ac2059eae60d095b4a096d5c8 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Mon, 12 Nov 2012 16:37:24 +0100 Subject: [PATCH] Use all available vars for hosts:, user: and sudo_user: --- lib/ansible/playbook/play.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index ebb8db2641..3e99d1bea8 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -57,22 +57,21 @@ class Play(object): raise errors.AnsibleError('hosts declaration is required') elif isinstance(hosts, list): hosts = ';'.join(hosts) - hosts = utils.template(basedir, hosts, playbook.extra_vars) self._ds = ds self.playbook = playbook self.basedir = basedir - self.hosts = hosts - self.name = ds.get('name', self.hosts) self.vars = ds.get('vars', {}) self.vars_files = ds.get('vars_files', []) self.vars_prompt = ds.get('vars_prompt', {}) self.vars = self._get_vars() + self.hosts = utils.template(basedir, hosts, self.vars) + self.name = ds.get('name', self.hosts) self._tasks = ds.get('tasks', []) self._handlers = ds.get('handlers', []) - self.remote_user = utils.template(basedir, ds.get('user', self.playbook.remote_user), playbook.extra_vars) + self.remote_user = utils.template(basedir, ds.get('user', self.playbook.remote_user), self.vars) self.remote_port = ds.get('port', self.playbook.remote_port) self.sudo = ds.get('sudo', self.playbook.sudo) - self.sudo_user = utils.template(basedir, ds.get('sudo_user', self.playbook.sudo_user), playbook.extra_vars) + self.sudo_user = utils.template(basedir, ds.get('sudo_user', self.playbook.sudo_user), self.vars) self.transport = ds.get('connection', self.playbook.transport) self.tags = ds.get('tags', None) self.gather_facts = ds.get('gather_facts', None)