mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
avoid path issues by determining the path of ansible-pull and using its path to run ansible and ansible-playbook
This commit is contained in:
parent
f8ec1451ea
commit
4ce791fe84
1 changed files with 6 additions and 3 deletions
|
@ -186,9 +186,12 @@ def main(args):
|
||||||
if path is None:
|
if path is None:
|
||||||
sys.stderr.write("module '%s' not found.\n" % options.module_name)
|
sys.stderr.write("module '%s' not found.\n" % options.module_name)
|
||||||
return 1
|
return 1
|
||||||
cmd = 'ansible localhost -i "%s" %s -m %s -a "%s"' % (
|
|
||||||
inv_opts, base_opts, options.module_name, repo_opts
|
bin_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
cmd = '%s/ansible localhost -i "%s" %s -m %s -a "%s"' % (
|
||||||
|
bin_path, inv_opts, base_opts, options.module_name, repo_opts
|
||||||
)
|
)
|
||||||
|
|
||||||
for ev in options.extra_vars:
|
for ev in options.extra_vars:
|
||||||
cmd += ' -e "%s"' % ev
|
cmd += ' -e "%s"' % ev
|
||||||
|
|
||||||
|
@ -221,7 +224,7 @@ def main(args):
|
||||||
print >>sys.stderr, "Could not find a playbook to run."
|
print >>sys.stderr, "Could not find a playbook to run."
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
cmd = 'ansible-playbook %s %s' % (base_opts, playbook)
|
cmd = '%s/ansible-playbook %s %s' % (bin_path, base_opts, playbook)
|
||||||
if options.vault_password_file:
|
if options.vault_password_file:
|
||||||
cmd += " --vault-password-file=%s" % options.vault_password_file
|
cmd += " --vault-password-file=%s" % options.vault_password_file
|
||||||
if options.inventory:
|
if options.inventory:
|
||||||
|
|
Loading…
Reference in a new issue