W3cubDocs

/Ansible

community.general.pear – Manage pear/pecl packages

Note

This plugin is part of the community.general collection (version 3.8.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.pear.

Synopsis

  • Manage PHP packages with the pear package manager.

Parameters

Parameter Choices/Defaults Comments
executable
path
Path to the pear executable.
name
string / required
Name of the package to install, upgrade, or remove.

aliases: pkg
prompts
list / elements=raw
added in 0.2.0 of community.general
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 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, null.
state
string
    Choices:
  • present
  • installed
  • latest
  • absent
  • removed
Desired state of the package.

Examples

- name: Install pear package
  community.general.pear:
    name: Net_URL2
    state: present

- name: Install pecl package
  community.general.pear:
    name: pecl/json_post
    state: present

- name: Install pecl package with expected prompt
  community.general.pear:
    name: pecl/apcu
    state: present
    prompts:
        - (.*)Enable internal debugging in APCu \[no\]

- name: Install pecl package with expected prompt and an answer
  community.general.pear:
    name: pecl/apcu
    state: present
    prompts:
        - (.*)Enable internal debugging in APCu \[no\]: "yes"

- 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.
  community.general.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"

- 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.
  community.general.pear:
    name: pecl/gnupg, pecl/apcu
    state: present
    prompts:
      - null
      - (.*)Enable internal debugging in APCu \[no\]: "yes"

- name: Upgrade package
  community.general.pear:
    name: Net_URL2
    state: latest

- name: Remove packages
  community.general.pear:
    name: Net_URL2,pecl/json_post
    state: absent

Authors

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/pear_module.html