community.general.cpanm module – Manages Perl library dependencies
Note
This module is part of the community.general collection (version 10.7.5).
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.
To use it in a playbook, specify: community.general.cpanm.
Synopsis
- Manage Perl library dependencies using cpanminus. 
Parameters
| Parameter | Comments | 
|---|---|
| Override the path to the cpanm executable. | |
| The local directory or  | |
| If  If  If parameter is not set,  When these dependencies fail to install, cpanm continues the installation, since they are just recommendation. Choices: 
 | |
| If  If  If parameter is not set,  When these dependencies fail to install, cpanm continues the installation, since they are just suggestion. Choices: 
 | |
| Only install dependencies. Choices: 
 | |
| Specify the install base to install modules. | |
| Specifies the base URL for the CPAN mirror to use. | |
| Use the mirror’s index file instead of the CPAN Meta DB. Choices: 
 | |
| Controls the module behavior. See notes below for more details. The default changed from  Choices: 
 | |
| Do not run unit tests. Choices: 
 | |
| Version specification for the perl module. When  | 
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
- Please note that http://search.cpan.org/dist/App-cpanminus/bin/cpanm, cpanm must be installed on the remote host. 
- This module now comes with a choice of execution - mode:- compatibilityor- new.
- mode=compatibility: When using- compatibilitymode, the module keeps backward compatibility. This was the default mode before community.general 9.0.0.- namemust be either a module name or a distribution file. If the perl module given by- nameis installed (at the exact- versionwhen specified), then nothing happens. Otherwise, it is installed using the- cpanmexecutable.- namecannot be an URL, or a git URL.- cpanmversion specifiers do not work in this mode.
- mode=new: When using- newmode, the module behaves differently. The- nameparameter may refer to a module name, a distribution file, a HTTP URL or a git repository URL as described in- cpanminusdocumentation.- cpanmversion specifiers are recognized. This is the default mode from community.general 9.0.0 onwards.
See Also
See also
- C(cpanm) command manual page
- Manual page for the command. 
Examples
- name: Install Dancer perl package
  community.general.cpanm:
    name: Dancer
- name: Install version 0.99_05 of the Plack perl package
  community.general.cpanm:
    name: MIYAGAWA/Plack-0.99_05.tar.gz
- name: Install Dancer into the specified locallib
  community.general.cpanm:
    name: Dancer
    locallib: /srv/webapps/my_app/extlib
- name: Install perl dependencies from local directory
  community.general.cpanm:
    from_path: /srv/webapps/my_app/src/
- name: Install Dancer perl package without running the unit tests in indicated locallib
  community.general.cpanm:
    name: Dancer
    notest: true
    locallib: /srv/webapps/my_app/extlib
- name: Install Dancer perl package from a specific mirror
  community.general.cpanm:
    name: Dancer
    mirror: 'http://cpan.cpantesters.org/'
- name: Install Dancer perl package into the system root path
  become: true
  community.general.cpanm:
    name: Dancer
- name: Install Dancer if it is not already installed OR the installed version is older than version 1.0
  community.general.cpanm:
    name: Dancer
    version: '1.0'
Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Description | 
|---|---|
| Version of CPANMinus. Returned: always Sample:  | 
