Note
This module is part of the community.general collection (version 10.7.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.pipx.
New in community.general 3.8.0
The below requirements are needed on the host that executes this module.
name with version specifiers, the Python package packaging is required.packaging is at a version lesser than 22.0.0, it fails silently when processing invalid specifiers, like tox<<<<4.0.Parameter | Comments |
|---|---|
editable boolean added in community.general 4.6.0 | Install the project in editable mode. Choices:
|
executable path | Path to the If not specified, the module will use |
force boolean | Force modification of the application’s virtual environment. See Only used when The module is not idempotent when Choices:
|
global boolean added in community.general 9.4.0 | The module will pass the The Choices:
|
include_injected boolean | Upgrade the injected packages along with the application. Only used when This is used with Choices:
|
index_url string | Base URL of Python Package Index. Only used when |
inject_packages list / elements=string | Packages to be injected into an existing virtual environment. Only used when |
install_apps boolean added in community.general 6.5.0 | |
install_deps boolean | Include applications of dependent packages. Only used when Choices:
|
name string | The name of the application and also the name of the Python package being installed. In If Starting in community.general 10.7.0, you can use package specifiers when Please note that when you use Use |
pip_args string added in community.general 4.6.0 | Arbitrary arguments to pass directly to |
python string | Python version to be used when creating the application virtual environment. Must be 3.6+. Only used when |
source string | Source for the package. This option is used when Use The value of this option is passed as-is to
The module is not idempotent when using |
spec_metadata path added in community.general 9.4.0 | Spec metadata file for This content of the file is usually generated with |
state string | Desired state for the application. The states The state The states Choices:
|
suffix string added in community.general 9.3.0 | Optional suffix for virtual environment and executable names. Warning: |
system_site_packages boolean added in community.general 6.6.0 | Give application virtual environment access to the system site-packages directory. Only used when Choices:
|
Attribute | Support | Description |
|---|---|---|
check_mode | Support: full | Can run in |
diff_mode | Support: full | Will return details on what has changed (or possibly needs changing in |
Note
pipx version 0.16.2.1 or above. From community.general 11.0.0 onwards, the module will require pipx>=1.7.0.pipx requires Python 3.6 or above.pipx python package, however that can be easily done with the module ansible.builtin.pip.pipx to be in the shell PATH, but it must be loadable by Python as a module.pipx environment variables such as but not limited to PIPX_HOME and PIPX_BIN_DIR passed using the environment Ansible keyword.See also
Manual page for the command.
- name: Install tox
community.general.pipx:
name: tox
- name: Install tox from git repository
community.general.pipx:
name: tox
source: git+https://github.com/tox-dev/tox.git
- name: Upgrade tox
community.general.pipx:
name: tox
state: upgrade
- name: Install or upgrade tox with extra 'docs'
community.general.pipx:
name: tox
source: tox[docs]
state: latest
- name: Reinstall black with specific Python version
community.general.pipx:
name: black
state: reinstall
python: 3.7
- name: Uninstall pycowsay
community.general.pipx:
name: pycowsay
state: absent
- name: Install multiple packages from list
vars:
pipx_packages:
- pycowsay
- black
- tox
community.general.pipx:
name: "{{ item }}"
state: latest
with_items: "{{ pipx_packages }}"
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
version string added in community.general 10.1.0 | Version of pipx. Returned: always Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/pipx_module.html