我可以使用puppet在aws ec2上将php升级到php56而不登录并使用yum吗?

显然,如果您使用puppet要求“php”并且安装了5.3版本,那么即使您的yum回购已经 5.6 php包,要求“php56”不会执行升级。 我读到的所有文档都说要登录节点并使用sudo和yum删除现有的php包并用5.6替换它们。 这些节点正在生产中,我想用puppet来升级我的php。 任何人都有这方面的经验吗?</ p>
</ div>

展开原文

原文

Apparently if you use puppet to require "php" and you have version 5.3 installed, then even if your yum repos have 5.6 php packages, requiring "php56" will not perform an upgrade. All the docs I read say to log into the node and use sudo and yum to remove the existing php packages and replace them with 5.6. These nodes are in production and I would like to use puppet to upgrade my php. Anyone have experience in this?

1个回答

Generally speaking, Puppet will only upgrade packages if you use a resource such as the following:

# always update to the latest version
package { 'php':
  ensure => 'latest',
}

# update (or revert) to a specific version
package { 'php':
  ensure => '5.6',
}

Note that in the latter case, the given version must exactly match the label on the package, e.g. 5.6.24+dfsg-0+deb8u1 on Debian 8.

Since you're probably using a Forge module to manage PHP (you should), you need to check that module's capabilities to override the appropriate ensure value(s).

If none, you can resort to a minor hack using a resource collector:

Package<| title == "php" |> { ensure => 'latest' }

This has same caveats, but might just suffice for your use case.

Whatever you do, test the code carefully before throwing it at your entire production environment.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐