Commit f6497770 by Seth Vidal

- make extra-vars override all other vars and facts in playbooks

parent 0243b7be
......@@ -315,6 +315,8 @@ class PlayBook(object):
continue
facts = result.get('ansible_facts', {})
self.SETUP_CACHE[host].update(facts)
# extra vars need to always trump - so update again following the facts
self.SETUP_CACHE[host].update(self.extra_vars)
if task.register:
if 'stdout' in result:
result['stdout_lines'] = result['stdout'].splitlines()
......@@ -390,7 +392,7 @@ class PlayBook(object):
''' run a list of tasks for a given pattern, in order '''
self.callbacks.on_play_start(play.name)
self.SETUP_CACHE.update(play.vars)
# if no hosts matches this play, drop out
if not self.inventory.list_hosts(play.hosts):
self.callbacks.on_no_hosts_matched()
......
......@@ -186,6 +186,9 @@ class Play(object):
else:
vars.update(self.vars)
if type(self.playbook.extra_vars) == dict:
vars.update(self.playbook.extra_vars)
if type(self.vars_prompt) == list:
for var in self.vars_prompt:
if not 'name' in var:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment