Note that there are some explanatory texts on larger screens.

plurals
  1. POInstalling PHP Pear packages via Ansible with idempotency
    text
    copied!<p>I'm currently installing Pear packages for PHP with Ansible like so:</p> <pre><code>- name: Add Phergie PEAR channel. command: pear channel-discover pear.phergie.org ignore_errors: yes - name: Install Phergie and related plugins. command: pear install pear.phergie.org/{{ item }} with_items: - Phergie - Phergie_Plugin_AltNick ignore_errors: yes </code></pre> <p>The <code>ignore_errors</code> is required because pear always reports an error when running a command that's been run/completed successfully before (like:</p> <pre><code>TASK: [Add Phergie PEAR channel.] ********************************************* failed: [10.31.9.210] =&gt; {"changed": true, "cmd": ["pear", "channel-discover", "pear.phergie.org"], "delta": "0:00:01.089340", "end": "2013-12-27 10:16:25.640083", "item": "", "rc": 1, "start": "2013-12-27 10:16:24.550743"} stdout: Channel "pear.phergie.org" is already initialized ...ignoring TASK: [Install Phergie and related plugins.] ********************************** failed: [10.31.9.210] =&gt; (item=Phergie) =&gt; {"changed": true, "cmd": ["pear", "install", "pear.phergie.org/Phergie"], "delta": "0:00:03.698780", "end": "2013-12-27 10:16:30.337371", "item": "Phergie", "rc": 1, "start": "2013-12-27 10:16:26.638591"} stdout: phergie/Phergie is already installed and is the same as the released version 2.1.0 install failed ...ignoring failed: [10.31.9.210] =&gt; (item=Phergie_Plugin_AltNick) =&gt; {"changed": true, "cmd": ["pear", "install", "pear.phergie.org/Phergie_Plugin_AltNick"], "delta": "0:00:01.779589", "end": "2013-12-27 10:16:33.231524", "item": "Phergie_Plugin_AltNick", "rc": 1, "start": "2013-12-27 10:16:31.451935"} stdout: phergie/Phergie_Plugin_AltNick is already installed and is the same as the released version 2.1.0 install failed ...ignoring </code></pre> <p>Is there a better (more idempotent) way to run pear commands, and not have to scroll through a bunch of big, red ignored errors?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload