如何启用软件收集软件

时间:2016-05-23 16:30:55

标签: chef chef-recipe

我是Chef的新手,我正在尝试编写一个将从软件集中安装php 5.6的Chef配方。

安装步骤如下:

// Step:1
sudo yum install centos-release-scl //id Centos
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms //if RHEL
// Step:2
sudo yum install rh-php56
// Step: 3
scl enable rh-php56 bash

到目前为止我做了什么:

case node['platform']
when 'centos'
  yum_package 'centos-release-scl'
when 'rhel'
  bash 'enable RHSCL' do
    code 'sudo yum-config-manager --enable rhel-server-rhscl-7-rpms'
  end
end

package 'rh-php56'

execute 'software-collection' do
  command 'scl enable rh-php56 bash'
end

我不知道为什么启用rh-php56的最后一部分无效。 我尝试过使用bash资源,但仍然没有结果。

干杯。

1 个答案:

答案 0 :(得分:1)

scl enable只能为您提供的特定命令(在您的示例中为bash)启用集合的问题。它不是一个全球性的环境。您必须在每个PHP命令前加上scl enable。我没有PHP的食谱,但请查看poise-ruby和poise-python如何处理SCL,以便在Chef中更全面地处理这个问题。

相关问题