Make sure playbook_dir variable is an absolute path

Fixes #8317
This commit is contained in:
James Cammarata 2014-08-12 09:51:21 -05:00
parent 8abd6370df
commit fc7859f445
3 changed files with 3 additions and 3 deletions

View file

@ -171,7 +171,7 @@ class PlayBook(object):
self.inventory.set_playbook_basedir(self.basedir)
vars = extra_vars.copy()
vars['playbook_dir'] = self.basedir
vars['playbook_dir'] = os.path.abspath(self.basedir)
if self.inventory.basedir() is not None:
vars['inventory_dir'] = self.inventory.basedir()

View file

@ -77,6 +77,7 @@ class Play(object):
self.tags = []
# make sure we have some special internal variables set
self.vars['playbook_dir'] = os.path.abspath(self.basedir)
if self.playbook.inventory.basedir() is not None:
self.vars['inventory_dir'] = self.playbook.inventory.basedir()
if self.playbook.inventory.src() is not None:
@ -153,7 +154,6 @@ class Play(object):
load_vars = {}
load_vars['role_names'] = ds.get('role_names',[])
load_vars['playbook_dir'] = self.basedir
self._tasks = self._load_tasks(self._ds.get('tasks', []), load_vars)
self._handlers = self._load_tasks(self._ds.get('handlers', []), load_vars)

View file

@ -612,7 +612,7 @@ class Runner(object):
inject['vars'] = self.module_vars
inject['defaults'] = self.default_vars
inject['environment'] = self.environment
inject['playbook_dir'] = self.basedir
inject['playbook_dir'] = os.path.abspath(self.basedir)
# template this one is available, callbacks use this
delegate_to = self.module_vars.get('delegate_to')