使用 puppet 安装 pear 包

Installing pear package using puppet

我正在尝试使用 puppet 安装 pear 包 "HTTP_Request2"。目标 OS 是 RHEL 7。

我遇到了 2 个木偶模块,我相信它们应该能够做到这一点

  1. https://forge.puppetlabs.com/rafaelfc/pear
  2. https://forge.puppetlabs.com/example42/php

理想情况下,我想使用 refaelfc 模块,因为它似乎更专门用于此任务。我遇到的问题是,要在目标服务器上访问互联网,你需要通过代理,我似乎无法在这个模块中找到任何东西来设置它。如果没有这个设置,puppet 在尝试安装模块时就会超时。

使用选项 2,我将以下内容添加到我的清单中:

    include php
    php::pear::config { http_proxy: value => "http://xx.xx.xx.xx:xxxx" }
    php::pear::module { 'HTTP_Request2':
            repository  => 'pear.phpunit.de',
            alldeps => 'true',
            require => Php::Pear::Config['http_proxy'],
    }

执行此操作时出现错误:

Error: Execution of '/bin/yum -d 0 -e 0 -y list php-pear-HTTP_Request2' returned 1: Error: No matching Packages to list

调用yum好像不太对吧?我怎样才能让 puppet 安装这个 pear 包?

使用 example42/php 模块和自定义脚本的组合设法让它工作:

    include php
    php::pear::config { http_proxy:
             value => "http://xx.xx.xx.xx:xxxx",
    }
    exec { 'HTTP_Request2':
            command => '/usr/bin/pear install HTTP_Request2',
            unless  => '/usr/bin/pear info HTTP_Request2',
            require => Php::Pear::Config['http_proxy'],
    }