community.general.pear (0.2.1) — module

Manage pear/pecl packages

Authors: Jonathan Lestrelin (@jle64) <jonathan.lestrelin@gmail.com>

Install collection

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


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.2.1

Description

Manage PHP packages with the pear package manager.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install pear package
  pear:
    name: Net_URL2
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install pecl package
  pear:
    name: pecl/json_post
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install pecl package with expected prompt
  pear:
    name: pecl/apcu
    state: present
    prompts:
        - (.*)Enable internal debugging in APCu \[no\]
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install pecl package with expected prompt and an answer
  pear:
    name: pecl/apcu
    state: present
    prompts:
        - (.*)Enable internal debugging in APCu \[no\]: "yes"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install multiple pear/pecl packages at once with prompts.
    Prompts will be processed on the same order as the packages order.
    If there is more prompts than packages, packages without prompts will be installed without any prompt expected.
    If there is more packages than prompts, additionnal prompts will be ignored.
  pear:
    name: pecl/gnupg, pecl/apcu
    state: present
    prompts:
      - I am a test prompt because gnupg doesnt asks anything
      - (.*)Enable internal debugging in APCu \[no\]: "yes"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install multiple pear/pecl packages at once skipping the first prompt.
    Prompts will be processed on the same order as the packages order.
    If there is more prompts than packages, packages without prompts will be installed without any prompt expected.
    If there is more packages than prompts, additionnal prompts will be ignored.
  pear:
    name: pecl/gnupg, pecl/apcu
    state: present
    prompts:
      - null
      - (.*)Enable internal debugging in APCu \[no\]: "yes"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Upgrade package
  pear:
    name: Net_URL2
    state: latest
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove packages
  pear:
    name: Net_URL2,pecl/json_post
    state: absent

Inputs

    
name:
    description:
    - Name of the package to install, upgrade, or remove.
    required: true

state:
    choices:
    - present
    - absent
    - latest
    default: present
    description:
    - Desired state of the package.

prompts:
    description:
    - List of regular expressions that can be used to detect prompts during pear package
      installation to answer the expected question.
    - Prompts will be processed in the same order as the packages list.
    - You can optionnally specify an answer to any question in the list.
    - If no answer is provided, the list item will only contain the regular expression.
    - 'To specify an answer, the item will be a dict with the regular expression as key
      and the answer as value C(my_regular_expression: ''an_answer'').'
    - You can provide a list containing items with or without answer.
    - A prompt list can be shorter or longer than the packages list but will issue a warning.
    - If you want to specify that a package will not need prompts in the middle of a list,  C(null).
    elements: raw
    type: list
    version_added: 0.2.0
    version_added_collection: community.general

executable:
    description:
    - Path to the pear executable.