python_requirements_facts - Show python path and assert dependency versions

New in version 2.7.

Synopsis

Parameters

Parameter Choices/Defaults Comments
dependencies
A list of version-likes or module names to check for installation. Supported operators: <, >, <=, >=, or ==. The bare module name like ansible, the module with a specific version like boto3==1.6.1, or a partial version like requests>2 are all valid specifications.

Examples

- name: show python lib/site paths
  python_requirements_facts:
- name: check for modern boto3 and botocore versions
  python_requirements_facts:
    dependencies:
    - boto3>1.6
    - botocore<2

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
mismatched
dict
always
A dictionary of dependencies that did not satisfy the desired version

Sample:
{'botocore': {'desired': 'botocore>2', 'installed': '1.10.60'}}
not_found
dict
always
A list of packages that could not be imported at all, and are not installed

Sample:
['boto4', 'riquests']
python
str
always
path to python version used

Sample:
/usr/local/opt/[email protected]/bin/python2.7
python_system_path
list
always
List of paths python is looking for modules in

Sample:
['/usr/local/opt/[email protected]/site-packages/', '/usr/lib/python/site-packages/', '/usr/lib/python/site-packages/']
python_version
str
always
version of python

Sample:
2.7.15 (default, May 1 2018, 16:44:08) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)]
valid
dict
always
A dictionary of dependencies that matched their desired versions. If no version was specified, then desired will be null

Sample:
{'boto3': {'desired': None, 'installed': '1.7.60'}, 'botocore': {'desired': 'botocore<2', 'installed': '1.10.60'}}


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Will Thames (@willthames)
  • Ryan Scott Brown (@ryan_sb)

Hint

If you notice any issues in this documentation you can edit this document to improve it.