本文系统Centos6.0 puppet版本:2.6.18
先来看下module的路径及最基本的目录结构:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[root@master modules]# puppet master --configprint modulepath
/etc/puppet/modules:/usr/share/puppet/modules
[root@master modules]# pwd
/etc/puppet/modules
[root@master modules]# tree -l
.
└── ssh
├── files #文件目录
│ └── sshd_config #要下载的文件
├── manifests
│ └── init.pp
└── templates #模版文件
4
directories,
2
files
|
查看site.pp要包含模块名
1
2
|
[root@master ~]# vim /etc/puppet/manifests/site.pp
include
"ssh"
|
查看模块内容
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
[root@master ~]# vim /etc/puppet/modules/ssh/manifests/init.pp
class
ssh {
package
{
"openssh-server"
:
ensure => present,
}
file {
"/etc/ssh/sshd_config"
:
ensure => present,
owner => root,
group => root,
mode =>
0600
,
source =>
"puppet:///modules/ssh/sshd_config"
,
notify => service[
'sshd'
],
}
service {
"sshd"
:
ensure => running,
enable =>
true
,
hasrestart =>
true
,
hasstatus =>
true
,
}
}
|
上面文件可以实现:
安装openssh-server
将master端的sshd_config下载
然后重启sshd服务,并且实现开机启动
下面在客户端
本文转自 西索oO 51CTO博客,原文链接:http://blog.51cto.com/lansgg/1319717