【发布时间】:2011-10-14 14:26:39
【问题描述】:
我是 Puppet 世界的新手。我有 Ubuntu 11.04(64 位)服务器和客户端。我已经安装了最新版本的 puppet 服务器和客户端。 Puppet 配置运行成功。我能够从我的客户端连接到服务器。
我想编写一个在我的客户端上安装 Apache2 的方法。谁能告诉我在我的客户端上安装 Apache2 的木偶配方的链接或逐步创建过程?如何运行以及在哪里运行这些配方?
在哪里可以看到错误文件?我怎么知道我的食谱工作正常?
init.pp 文件是
file {"password":
name=>"/etc/passwd",
owner =>"root",
group =>"bin",
mode=>644,
}
class apache{
package { httpd: ensure => installed }
service{ "httpd" :
name => $operatingsystem ?{
debian=>"apache2",
redhat=>"httpd",
default =>"apache",
CentOS=>"httpd",
},
ensure=> running,
require=>Package["httpd"],
}
}
node 'myclientname'{
include apache
}
# All of the nodes that don't have definitions associated with the will use
# the following node definition.
node default {
case $operatingsystem {
CentOS: { include apache }
default: {}
}
}
【问题讨论】:
-
到目前为止你尝试过什么?在askubuntu.com 上问这个问题你可能会更幸运。
-
我已经在服务器上编写了 init.pp。通过 puppet apply --verbose init.pp --noop 运行。我的客户端没有安装 apache。我收到信息:正在应用配置版本“1318681308”通知:/Stage[main]//File[password]/group: 是 root,应该是 bin(noop)。我应该做什么以及在哪里检查 conf 是写入还是错误。在哪里查看日志。
-
myinit.pp-- 文件 {"password": 02name=>"/etc/passwd", 03 owner =>"root",04 group =>"bin",05 mode=>644 ,06 } 08class apache{ 09 10 package { httpd: ensure => installed } 11 12 service{ "httpd" : 13 14name => $operatingsystem ?{15 debian=>"apache2",16 redhat=>"httpd",17 default =>"apache",18CentOS=>"httpd",19 },20ensure=> running,21 require=>Package["httpd"],22 }23 }2425 node 'myclientname'{26 include apache 27 } 28#没有与 关联的定义的所有其他节点将使用以下节点定义。 2930node 默认{31 case $operatingsystem {32CentOS:{includeapache}33 默认:{}34}35}
-
您应该将所有这些内容编辑到您的问题中(这也会在“活动”页面上撞到它,以便获得更多关注)。
标签: ubuntu-11.04 puppet