puppet 入门2

简介: file {"/etc/hosts":owner = root,group = root,mode = 644}filefile {"/etc/sudoers":owner = "root",group = "root",mode ...

file {"/etc/hosts":
owner = root,
group = root,
mode = 644
}
file
file {
"/etc/sudoers":
owner = "root",
group = "root",
mode = 644;
"/usr/sbin/sudo":
owner = "root",
group = "root",
mode = 4111
}
定义类
class sudo {
package { sudo: ensure = installed }
file {
"/etc/sudoers":
owner = "root",
group = "root",
mode = 644;
"/usr/sbin/sudo":
owner = "root",
group = "root",
mode = 4111
}
}
inherits 继承


img_c631b536c68f1258304a5501187731df.png
image.png

安装SSH并启动
class ssh {
package { ssh: ensure = installed }
file { sshd_config:
name = operatingsystem ? { Darwin = "/etc/sshd_config", Solaris = "/opt/csw/etc/ssh/sshd_config", default = "/etc/ssh/sshd_config" }, source = "puppet://server.domain.com/files/ssh/sshd_config" } service { ssh: name =operatingsystem ? {
Solaris = openssh,
default = ssh
},
ensure = running,
subscribe = [Package[ssh], File[sshd_config]]
}
}
subscribe = [Package[ssh], File[sshd_config]] 这个语句表示,如果package "ssh" 或者 文件" sshd_config"有修改, service ssh需要重启.

puppet条件语句:case,if else


img_7ec68ec14140d612d040d7e5a7835da0.png
image.png

数组:user { [bin, adm]: ensure = present }

defines重复使用


img_f626ee57c4e0749de35663b0cc3b622a.png
image.png
目录
相关文章
|
消息中间件 持续交付
|
安全 Linux 网络协议
puppet yum模块、配置仓储、mount模块
转载:http://blog.51cto.com/ywzhou/1577335 作用:自动为客户端配置YUM源,为使用yum安装软件包提供便捷。 1、服务端配置yum模块 (1)模块清单 [root@puppet ~]# tree /etc/puppe...
1105 0
|
网络协议 安全 网络安全
|
Perl 存储 数据挖掘