From 98073a264205594d3126aad057d5f6c8e09ce410 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Tue, 22 Feb 2022 20:59:04 +1300 Subject: [PATCH] ansible_galaxy_install: added no_deps option (#4240) * ansible_galaxy_install: added no_deps option * added changelog fragment * Update plugins/modules/packaging/language/ansible_galaxy_install.py Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- .../4240-ansible_galaxy_install-no_deps.yml | 2 ++ .../packaging/language/ansible_galaxy_install.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/4240-ansible_galaxy_install-no_deps.yml diff --git a/changelogs/fragments/4240-ansible_galaxy_install-no_deps.yml b/changelogs/fragments/4240-ansible_galaxy_install-no_deps.yml new file mode 100644 index 0000000000..716bc6cc16 --- /dev/null +++ b/changelogs/fragments/4240-ansible_galaxy_install-no_deps.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible_galaxy_install - added option ``no_deps`` to the module (https://github.com/ansible-collections/community.general/issues/4174). diff --git a/plugins/modules/packaging/language/ansible_galaxy_install.py b/plugins/modules/packaging/language/ansible_galaxy_install.py index 8173e40735..076e2b2d6a 100644 --- a/plugins/modules/packaging/language/ansible_galaxy_install.py +++ b/plugins/modules/packaging/language/ansible_galaxy_install.py @@ -53,6 +53,12 @@ options: Please notice that C(ansible-galaxy) will not install collections with I(type=both), when I(requirements_file) contains both roles and collections and I(dest) is specified. type: path + no_deps: + description: + - Refrain from installing dependencies. + version_added: 4.5.0 + type: bool + default: false force: description: - Force overwriting an existing role or collection. @@ -178,7 +184,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper): ansible_version = None is_ansible29 = None - output_params = ('type', 'name', 'dest', 'requirements_file', 'force') + output_params = ('type', 'name', 'dest', 'requirements_file', 'force', 'no_deps') module = dict( argument_spec=dict( type=dict(type='str', choices=('collection', 'role', 'both'), required=True), @@ -186,6 +192,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper): requirements_file=dict(type='path'), dest=dict(type='path'), force=dict(type='bool', default=False), + no_deps=dict(type='bool', default=False), ack_ansible29=dict(type='bool', default=False), ), mutually_exclusive=[('name', 'requirements_file')], @@ -201,6 +208,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper): requirements_file=dict(fmt=('-r', '{0}'),), dest=dict(fmt=('-p', '{0}'),), force=dict(fmt="--force", style=ArgFormat.BOOLEAN), + no_deps=dict(fmt="--no-deps", style=ArgFormat.BOOLEAN), ) force_lang = "en_US.UTF-8" check_rc = True @@ -293,7 +301,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper): self._setup29() else: self._setup210plus() - params = ('type', {'galaxy_cmd': 'install'}, 'force', 'dest', 'requirements_file', 'name') + params = ('type', {'galaxy_cmd': 'install'}, 'force', 'no_deps', 'dest', 'requirements_file', 'name') self.run_command(params=params) def process_command_output(self, rc, out, err):