pytoccaz.utils.python_module_check (1.1.0) — module

Is a python module available

| "added in version" 1.1.0 of pytoccaz.utils"

Authors: Olivier Bernard (@pytoccaz)

Install collection

Install with ansible-galaxy collection install pytoccaz.utils:==1.1.0


Add to requirements.yml

  collections:
    - name: pytoccaz.utils
      version: 1.1.0

Description

Is a python module available on target host

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
    - name: Is python-docker available ?
      pytoccaz.utils.python_module_check:
        name: docker
      register: module_docker
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
    - debug:
        var: module_docker.is_installed
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
    - name: Is html.parser available ?
      pytoccaz.utils.python_module_check:
        name: html.parser
      register: module_parser
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
    - debug:
        var: module_parser.is_installed
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
    - name: Is html.parser available (using package parameter) ?
      pytoccaz.utils.python_module_check:
        name: .parser
        package: html
      register: module_parser
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
    - debug:
        var: module_parser.is_installed

Inputs

    
name:
    aliases:
    - module_name
    description:
    - Name of the python module
    required: true
    type: str
    version_added: 1.1.0
    version_added_collection: pytoccaz.utils

package:
    description:
    - Path of the python package
    - Start name parameter value with a dot
    required: false
    type: str
    version_added: 1.1.0
    version_added_collection: pytoccaz.utils

Outputs

is_installed:
  description: If the python module is actually installed
  returned: always
  sample: true
  type: bool