pytoccaz.utils.binary_info (1.4.0) — module

Finds a system executable on the target host

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

Authors: Olivier Bernard (@pytoccaz)

Install collection

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


Add to requirements.yml

  collections:
    - name: pytoccaz.utils
      version: 1.4.0

Description

Finds a system executable within C($PATH) on the target host.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Search python3 in PATH
  pytoccaz.utils.binary_info:
    name: python3
  register: python_binary
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- debug:
    var: python_binary.path

Inputs

    
name:
    aliases:
    - binary
    description:
    - Name of the binary
    required: true
    type: str
    version_added: 1.0.0
    version_added_collection: pytoccaz.utils

option_dirs:
    aliases:
    - opt_dirs
    description:
    - Optional list of directories to search in addition to PATH
    elements: str
    required: false
    type: list
    version_added: 1.0.0
    version_added_collection: pytoccaz.utils

Outputs

exists:
  description: If the destination path actually exists and the user can access it
  returned: always
  sample: true
  type: bool
gid:
  description: Numeric id representing the group of the owner
  returned: when exists is true
  sample: 0
  type: int
group:
  description: Group name of owner
  returned: when exists is true
  sample: root
  type: str
mode:
  description: Unix permissions of the file in octal representation as a string
  returned: when exists is true
  sample: '0777'
  type: str
owner:
  description: Name of owner
  returned: when exists is true
  sample: root
  type: str
path:
  description: Path of the searched binary if it exists in PATH and the user can access
    it, else null
  returned: always
  sample: /usr/bin/python3
  type: str
size:
  description: Size in bytes for a plain file, amount of data for some special files
  returned: when exists is true
  sample: 9
  type: int
state:
  description: Nature of the file
  returned: when exists is true
  sample: link
  type: str
uid:
  description: Numeric id representing the file owner
  returned: when exists is true
  sample: 0
  type: int