community.general.ansible_galaxy_install module – Install Ansible roles or collections using ansible-galaxy
Note
This module is part of the community.general collection (version 5.8.3).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.ansible_galaxy_install
.
New in community.general 3.5.0
Synopsis
This module allows the installation of Ansible collections or roles using
ansible-galaxy
.
Requirements
The below requirements are needed on the host that executes this module.
Ansible 2.9, ansible-base 2.10, or ansible-core 2.11 or newer
Parameters
Parameter |
Comments |
---|---|
Acknowledge using Ansible 2.9 with its limitations, and prevents the module from generating warnings about them. This option is completely ignored if using a version of Ansible greater than Note that this option will be removed without any further deprecation warning once support for Ansible 2.9 is removed from this module. Choices:
|
|
Acknowledge the module is deprecating support for Ansible 2.9 and ansible-base 2.10. Support for those versions will be removed in community.general 8.0.0. At the same time, this option will be removed without any deprecation warning! This option is completely ignored if using a version of ansible-core/ansible-base/Ansible greater than For the sake of conciseness, setting this parameter to Choices:
|
|
The path to the directory containing your collections or roles, according to the value of type. Please notice that |
|
Force overwriting an existing role or collection. Using force=true is mandatory when downgrading. Ansible 2.9 and 2.10: Must be Choices:
|
|
Name of the collection or role being installed. Versions can be specified with name and requirements_file are mutually exclusive. |
|
Refrain from installing dependencies. Choices:
|
|
Path to a file containing a list of requirements to be installed. It works for type equals to name and requirements_file are mutually exclusive. Ansible 2.9: It can only be used to install either type=role or type=collection, but not both at the same run. |
|
The type of installation performed by If type is Note however that the opposite is not true: if using a requirements_file, then type can be any of the three choices. Ansible 2.9: The option Choices:
|
Notes
Note
Ansible 2.9/2.10: The
ansible-galaxy
command changed significantly between Ansible 2.9 and ansible-base 2.10 (later ansible-core 2.11). See comments in the parameters.
Examples
- name: Install collection community.network
community.general.ansible_galaxy_install:
type: collection
name: community.network
- name: Install role at specific path
community.general.ansible_galaxy_install:
type: role
name: ansistrano.deploy
dest: /ansible/roles
- name: Install collections and roles together
community.general.ansible_galaxy_install:
type: both
requirements_file: requirements.yml
- name: Force-install collection community.network at specific version
community.general.ansible_galaxy_install:
type: collection
name: community.network:3.0.2
force: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The value of the dest parameter. Returned: always |
|
The value of the force parameter. Returned: always |
|
If requirements_file is specified instead, returns dictionary with all the collections installed per path. If name is specified, returns that collection name and the version installed per path. Ansible 2.9: Returns empty because Returned: always when installing collections Sample: |
|
Collections and versions for that path Returned: success |
|
If requirements_file is specified instead, returns dictionary with all the roles installed per path. If name is specified, returns that role name and the version installed per path. Ansible 2.9: Returns empty because Returned: always when installing roles Sample: |
|
Roles and versions for that path. Returned: success |
|
The value of the name parameter. Returned: always |
|
New collections installed by this module. Returned: success Sample: |
|
New roles installed by this module. Returned: success Sample: |
|
The value of the requirements_file parameter. Returned: always |
|
The value of the type parameter. Returned: always |
Collection links
Issue Tracker Repository (Sources) Submit a bug report Request a feature Communication