community.general.pip_package_info (8.5.0) — module

Pip package information

Authors: Matthew Jones (@matburt), Brian Coca (@bcoca), Adam Miller (@maxamillion)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Return information about installed pip packages


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Just get the list from default pip
  community.general.pip_package_info:
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get the facts for default pip, pip2 and pip3.6
  community.general.pip_package_info:
    clients: ['pip', 'pip2', 'pip3.6']
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get from specific paths (virtualenvs?)
  community.general.pip_package_info:
    clients: '/home/me/projec42/python/pip3.5'

Inputs

    
clients:
    default:
    - pip
    description:
    - A list of the pip executables that will be used to get the packages. They can be
      supplied with the full path or just the executable name, for example V(pip3.7).
    elements: path
    required: false
    type: list

Outputs

packages:
  contains:
    python:
      description: A dictionary with each pip client which then contains a list of
        dicts with python package information
      returned: always
      sample:
        packages:
          pip:
            Babel:
            - name: Babel
              source: pip
              version: 2.6.0
            Flask:
            - name: Flask
              source: pip
              version: 1.0.2
            Flask-SQLAlchemy:
            - name: Flask-SQLAlchemy
              source: pip
              version: 2.3.2
            Jinja2:
            - name: Jinja2
              source: pip
              version: '2.10'
      type: dict
  description: a dictionary of installed package data
  returned: always
  type: dict