cpanm: add installdeps option
This commit is contained in:
parent
d30e466103
commit
4b0dc387ce
1 changed files with 15 additions and 3 deletions
|
@ -58,6 +58,11 @@ options:
|
||||||
- Use the mirror's index file instead of the CPAN Meta DB
|
- Use the mirror's index file instead of the CPAN Meta DB
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
installdeps:
|
||||||
|
description:
|
||||||
|
- Only install dependencies
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
notes:
|
notes:
|
||||||
- Please note that U(http://search.cpan.org/dist/App-cpanminus/bin/cpanm, cpanm) must be installed on the remote host.
|
- Please note that U(http://search.cpan.org/dist/App-cpanminus/bin/cpanm, cpanm) must be installed on the remote host.
|
||||||
author: "Franck Cuny (@franckcuny)"
|
author: "Franck Cuny (@franckcuny)"
|
||||||
|
@ -94,7 +99,8 @@ def _is_package_installed(module, name, locallib, cpanm):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _build_cmd_line(name, from_path, notest, locallib, mirror, mirror_only, cpanm):
|
def _build_cmd_line(name, from_path, notest, locallib, mirror, mirror_only,
|
||||||
|
installdeps, cpanm):
|
||||||
# this code should use "%s" like everything else and just return early but not fixing all of it now.
|
# this code should use "%s" like everything else and just return early but not fixing all of it now.
|
||||||
# don't copy stuff like this
|
# don't copy stuff like this
|
||||||
if from_path:
|
if from_path:
|
||||||
|
@ -114,6 +120,9 @@ def _build_cmd_line(name, from_path, notest, locallib, mirror, mirror_only, cpan
|
||||||
if mirror_only is True:
|
if mirror_only is True:
|
||||||
cmd = "{cmd} --mirror-only".format(cmd=cmd)
|
cmd = "{cmd} --mirror-only".format(cmd=cmd)
|
||||||
|
|
||||||
|
if installdeps is True:
|
||||||
|
cmd = "{cmd} --installdeps".format(cmd=cmd)
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,6 +134,7 @@ def main():
|
||||||
locallib=dict(default=None, required=False),
|
locallib=dict(default=None, required=False),
|
||||||
mirror=dict(default=None, required=False),
|
mirror=dict(default=None, required=False),
|
||||||
mirror_only=dict(default=False, type='bool'),
|
mirror_only=dict(default=False, type='bool'),
|
||||||
|
installdeps=dict(default=False, type='bool'),
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
@ -139,6 +149,7 @@ def main():
|
||||||
locallib = module.params['locallib']
|
locallib = module.params['locallib']
|
||||||
mirror = module.params['mirror']
|
mirror = module.params['mirror']
|
||||||
mirror_only = module.params['mirror_only']
|
mirror_only = module.params['mirror_only']
|
||||||
|
installdeps = module.params['installdeps']
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
|
@ -146,7 +157,8 @@ def main():
|
||||||
|
|
||||||
if not installed:
|
if not installed:
|
||||||
out_cpanm = err_cpanm = ''
|
out_cpanm = err_cpanm = ''
|
||||||
cmd = _build_cmd_line(name, from_path, notest, locallib, mirror, mirror_only, cpanm)
|
cmd = _build_cmd_line(name, from_path, notest, locallib, mirror,
|
||||||
|
mirror_only, installdeps, cpanm)
|
||||||
|
|
||||||
rc_cpanm, out_cpanm, err_cpanm = module.run_command(cmd, check_rc=False)
|
rc_cpanm, out_cpanm, err_cpanm = module.run_command(cmd, check_rc=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue