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 8.6.7).
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
.
Aliases: packaging.language.ansible_galaxy_install
Requirements
The below requirements are needed on the host that executes this module.
ansible-core 2.11 or newer
Parameters
Parameter |
Comments |
---|---|
This option has no longer any effect and will be removed in community.general 9.0.0. Choices:
|
|
This option has no longer any effect and will be removed in community.general 9.0.0. Choices:
|
|
The path to the directory containing your collections or roles, according to the value of Please notice that |
|
Force overwriting an existing role or collection. Using Choices:
|
|
Name of the collection or role being installed. Versions can be specified with
|
|
Refrain from installing dependencies. Choices:
|
|
Path to a file containing a list of requirements to be installed. It works for
|
|
The type of installation performed by If Note however that the opposite is not true: if using a Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: none |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Notes
Note
Support for Ansible 2.9/2.10 was removed in community.general 8.0.0.
The module will try and run using the
C.UTF-8
locale. If that fails, it will tryen_US.UTF-8
. If that one also fails, the module will fail.
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 Returned: always |
|
The value of the Returned: always |
|
If If Returned: always when installing collections Sample: |
|
Collections and versions for that path Returned: success |
|
If If Returned: always when installing roles Sample: |
|
Roles and versions for that path. Returned: success |
|
The value of the Returned: always |
|
New collections installed by this module. Returned: success Sample: |
|
New roles installed by this module. Returned: success Sample: |
|
The value of the Returned: always |
|
The value of the Returned: always |