Merge pull request #4671 from sergevanginderachter/pb_basedir
include basedir as 'playbook_dir' variable
This commit is contained in:
commit
baccced4d4
3 changed files with 3 additions and 0 deletions
|
@ -138,6 +138,7 @@ class PlayBook(object):
|
||||||
self.basedir = os.path.dirname(playbook) or '.'
|
self.basedir = os.path.dirname(playbook) or '.'
|
||||||
utils.plugins.push_basedir(self.basedir)
|
utils.plugins.push_basedir(self.basedir)
|
||||||
vars = extra_vars.copy()
|
vars = extra_vars.copy()
|
||||||
|
vars['playbook_dir'] = self.basedir
|
||||||
if self.inventory.basedir() is not None:
|
if self.inventory.basedir() is not None:
|
||||||
vars['inventory_dir'] = self.inventory.basedir()
|
vars['inventory_dir'] = self.inventory.basedir()
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@ class Play(object):
|
||||||
self.max_fail_pct = int(ds.get('max_fail_percentage', 100))
|
self.max_fail_pct = int(ds.get('max_fail_percentage', 100))
|
||||||
|
|
||||||
load_vars = {}
|
load_vars = {}
|
||||||
|
load_vars['playbook_dir'] = self.basedir
|
||||||
if self.playbook.inventory.basedir() is not None:
|
if self.playbook.inventory.basedir() is not None:
|
||||||
load_vars['inventory_dir'] = self.playbook.inventory.basedir()
|
load_vars['inventory_dir'] = self.playbook.inventory.basedir()
|
||||||
|
|
||||||
|
|
|
@ -415,6 +415,7 @@ class Runner(object):
|
||||||
inject['vars'] = self.module_vars
|
inject['vars'] = self.module_vars
|
||||||
inject['defaults'] = self.default_vars
|
inject['defaults'] = self.default_vars
|
||||||
inject['environment'] = self.environment
|
inject['environment'] = self.environment
|
||||||
|
inject['playbook_dir'] = self.basedir
|
||||||
|
|
||||||
if self.inventory.basedir() is not None:
|
if self.inventory.basedir() is not None:
|
||||||
inject['inventory_dir'] = self.inventory.basedir()
|
inject['inventory_dir'] = self.inventory.basedir()
|
||||||
|
|
Loading…
Reference in a new issue