![](https://yqfile.alicdn.com/img_4e6f00c5f7630483d600df14926bdc2d.png?x-oss-process=image/resize,w_1400/format,webp)
puppet硬件需求
![](https://yqfile.alicdn.com/img_be7b653f7673ab94ed759e02613f4483.png?x-oss-process=image/resize,w_1400/format,webp)
搭建本地镜像源
搭建svn+apache ,搭建dnsmasq
/etc/puppet
auth.conf 认证
autosign.conf 自动签名
fileserver.conf 同步静态文件
manifests.......module
puppet.conf
tagmail.conf
namespaceauth.conf
puppet.conf main,master,agent
![](https://yqfile.alicdn.com/img_5830b9c48e32675bfbc98cc7c0525707.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_13ea53540e7179683e72a1f547df2cdf.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_36a273a4687691ccadfee108791a8c60.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_9e28bee0ba226494f8b5586c10135b45.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_33a0cb0bfb02f762757effa0a5eeb3c3.png?x-oss-process=image/resize,w_1400/format,webp)
生成配置文件puppet.conf puppet master --genconfig
服务端常用配置项
![](https://yqfile.alicdn.com/img_b9bcbdfb3710f8818c4ab83696ce533e.png?x-oss-process=image/resize,w_1400/format,webp)
auth.conf访问控制
![](https://yqfile.alicdn.com/img_5507043d63c4e520a5ee0dcc0baff354.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_bd55a51c3596af2c61fb467e9a7c298b.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_5d1619cd93ef039b69e58c63d32d6f9c.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_d1892d10618f8b07e8abdf917cd3f5c6.png?x-oss-process=image/resize,w_1400/format,webp)
acl控制
![](https://yqfile.alicdn.com/img_02ee2491e31b4fe35e08e5d6d705e44b.png?x-oss-process=image/resize,w_1400/format,webp)
fileserver.conf 挂载点 使用方式
![](https://yqfile.alicdn.com/img_c6db02722557726c24572d7005e3f3ac.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_db0aabcc53c305f382f98416fbad50fb.png?x-oss-process=image/resize,w_1400/format,webp)
puppet help puppet help ca
puppet master puppet agent puppet cert puppet module puppet resource puppet describe puppet parser validate
site.pp是导航文件:/etc/puppet/manifests/site.pp
notify == echo:notify{"hello world"} 放在site.pp
启动服务端: xx 2>&1
nohup puppet master --verbose --no-daemonize>>master.log 2>&1 &
iptables -t filter -A INPUT -p tcp -m state -state NEW --dport 8140 -j ACCEPT
puppet agent --server xxxx --test
puppet cert --sign xxxx
site.pp中节点格式
![](https://yqfile.alicdn.com/img_1503d87a6cf55d608aea602f9857c54c.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_3c4ff44d72d5fda1a070bcf8cb676dfd.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_d69a682524f81dbd56be87604c778c6f.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_ac4af4b8a31c3b49ad4ceb769c16037e.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_9000855c1ef9ed5c43ca1dfe4ae96c09.png?x-oss-process=image/resize,w_1400/format,webp)
没有匹配到,就到默认default
![](https://yqfile.alicdn.com/img_87fccd51a710a63cd1905bcc5da88b40.png?x-oss-process=image/resize,w_1400/format,webp)
从puppet forge 获取基础模块:http://forge.puppetlabs.com/
class
![](https://yqfile.alicdn.com/img_467350b70da7248e79790df3424ad363.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_a517fa7d5b74172ed3b09b63e3354432.png?x-oss-process=image/resize,w_1400/format,webp)
inherits
![](https://yqfile.alicdn.com/img_3aee92ee0604839cc208c509e2b0890a.png?x-oss-process=image/resize,w_1400/format,webp)
类继承
![](https://yqfile.alicdn.com/img_c865b21cb00ce094bc24bc502178a376.png?x-oss-process=image/resize,w_1400/format,webp)
灰度发布:开发-测试-生产
![](https://yqfile.alicdn.com/img_a8406ecd8ce41bd0dc6d7166592e6a2d.png?x-oss-process=image/resize,w_1400/format,webp)
变量
![](https://yqfile.alicdn.com/img_0dcf2d64a55bd0bd25a035a23762f7af.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_4ab01e3d8b9fcb35ed59f680d53a0381.png?x-oss-process=image/resize,w_1400/format,webp)
puppet不能重复赋值
![](https://yqfile.alicdn.com/img_289bc5a8afb34a45465f5b9f608f8864.png?x-oss-process=image/resize,w_1400/format,webp)
facter常用变量:ipaddress,kernel,memorysize,operatingsystem,rubyversion,uptime,hostname
![](https://yqfile.alicdn.com/img_6982f14840f36bdf17d2b43f0b4613c0.png?x-oss-process=image/resize,w_1400/format,webp)
数组
![](https://yqfile.alicdn.com/img_f05d10cd4afe949976e07fe0613f0557.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_6096664488f68a36b006954553abb330.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_f9fd9c4d775da23f55806f17c3c5739c.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_eee0e2161d92eef78ab2f0929abf721e.png?x-oss-process=image/resize,w_1400/format,webp)
字典
![](https://yqfile.alicdn.com/img_24d8c5238118ebd85aa9438e14babf69.png?x-oss-process=image/resize,w_1400/format,webp)
布尔
![](https://yqfile.alicdn.com/img_19c18dfebdd6205ecc27b1fc020ab31e.png?x-oss-process=image/resize,w_1400/format,webp)
/正则/:[a-z] () \w \W \s \S \d \D \b \B * + {m,n} ?
![](https://yqfile.alicdn.com/img_9c4bee8dd45642296a5c455e3aa30e63.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_42ea735c9c948c184528e68ca9a40153.png?x-oss-process=image/resize,w_1400/format,webp)
if elsif else
![](https://yqfile.alicdn.com/img_fb7fcec73d9eceab0912e1fcb0f29ce0.png?x-oss-process=image/resize,w_1400/format,webp)
=~
![](https://yqfile.alicdn.com/img_6238ccfc3f68cfd0033da7795e41333b.png?x-oss-process=image/resize,w_1400/format,webp)
in
![](https://yqfile.alicdn.com/img_9b5ebd5171095cfbda008a2f82f9116f.png?x-oss-process=image/resize,w_1400/format,webp)
case 用法:
case
default: {}
}
xx = xx ? {字典}
![](https://yqfile.alicdn.com/img_8cbee2b00cba8bca42414bdf3cbc307c.png?x-oss-process=image/resize,w_1400/format,webp)
define
![](https://yqfile.alicdn.com/img_ab67e6b0db83ae8412ab4f5e08a15e5f.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_fac8800f2399e5e00419546dbc70a6f5.png?x-oss-process=image/resize,w_1400/format,webp)
tag????
![](https://yqfile.alicdn.com/img_31b9bc9f978009bc860b41aab6a582e5.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_70adb19bb01ccf5b940fca42412d1890.png?x-oss-process=image/resize,w_1400/format,webp)
generate
![](https://yqfile.alicdn.com/img_edcdec0f4cc4b4b9da59e5dde9293c14.png?x-oss-process=image/resize,w_1400/format,webp)
template
![](https://yqfile.alicdn.com/img_9f5114cac715409b47ef7a3c41ec71a6.png?x-oss-process=image/resize,w_1400/format,webp)
类的继承
![](https://yqfile.alicdn.com/img_7fe3522fc9494d05c1f87a3fd0de9811.png?x-oss-process=image/resize,w_1400/format,webp)
文件导入
![](https://yqfile.alicdn.com/img_e98ef551604140d6c769c8326348acfe.png?x-oss-process=image/resize,w_1400/format,webp)
模块导入方式:
![](https://yqfile.alicdn.com/img_c4ffa696281612dca3fc261401a75489.png?x-oss-process=image/resize,w_1400/format,webp)
资源
![](https://yqfile.alicdn.com/img_c3d78d4b683ac5fe3d87bdf31c73d148.png?x-oss-process=image/resize,w_1400/format,webp)
package 包安装工具
file {'name':
path:
ensure:absent present file directory link
backup:
checksum:md5
content:追加
group
links??
mode
owner
source:
target:
selxxxxxxxxxxxxxxxx
}
![](https://yqfile.alicdn.com/img_892a507b315d32fa3b86739d0101cf51.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_5b85e0b66504a4b3dbc1e15bef6858a0.png?x-oss-process=image/resize,w_1400/format,webp)
filebucket 文件备份与恢复
name,path,port,server
![](https://yqfile.alicdn.com/img_a5542abc17a6378261323a05943cdb3e.png?x-oss-process=image/resize,w_1400/format,webp)
host:DNS相关
![](https://yqfile.alicdn.com/img_596a08922f80bd413d200e7217d98f35.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_f9f3684ac88ea5f486a1db5abb28e240.png?x-oss-process=image/resize,w_1400/format,webp)
user属性
name,ensure,comment,uid,gid,groups,home,manage_expiry,password,manage_password_max_age,manage_password_min_age,shell,provider:aix/hpuxuseradd/ldap/pw/useradd/windows_adsi
新建用户
![](https://yqfile.alicdn.com/img_97f445fe90392f0061482e772272799f.png?x-oss-process=image/resize,w_1400/format,webp)
group
ensure,gid,members,name,provider:aix/groupadd/pw/windows_adsi
![](https://yqfile.alicdn.com/img_2f24e794a8f30830c08067e6e7845c3e.png?x-oss-process=image/resize,w_1400/format,webp)
package
allowcdrom,ensure:installed present/absent/latest/版本号5.4.23,provider:yum/apt/aix/windows,source
holdable保持现状,install_options 传递参数,installable,purgeable,uninstall_options,uninstallable,upgradeable,versionable
![](https://yqfile.alicdn.com/img_fd450647f4dc5c9dd408de4592875e51.png?x-oss-process=image/resize,w_1400/format,webp)
安装nginx
![](https://yqfile.alicdn.com/img_6e9893675e094c24859fee7cfcdb82f8.png?x-oss-process=image/resize,w_1400/format,webp)
数组方式批量安装
![](https://yqfile.alicdn.com/img_49715b96154f2c807efb6efd27e4dc7e.png?x-oss-process=image/resize,w_1400/format,webp)
service:
binary:程序路径,enable开机,ensure:running/stopped,hasrestart,hasstatus,name,path,pattern,restart,start,status,stop,provider:enableable/refreshable.
![](https://yqfile.alicdn.com/img_2e568f4ff61b94b0c78382b2b1efe092.png?x-oss-process=image/resize,w_1400/format,webp)
exec:
command,creates,cwd:执行路径,environment,group,logoutput,onlyif:只有该执行结果为0时才执行,path,refresh,refreshonly:ture/false触发器,returns,timeout,tries,try_sleep,user,provider:shell/windows
![](https://yqfile.alicdn.com/img_e8b6e52525868a08ab86cae0d3c29bfb.png?x-oss-process=image/resize,w_1400/format,webp)
cron:
command,ensure:present/absent,environment,hour,minute,month,monthday,weekday,name,provider,user
![](https://yqfile.alicdn.com/img_60547beb7f33bcf51b22c1f5a22ec1e9.png?x-oss-process=image/resize,w_1400/format,webp)
notify :name,message
公有属性:before,require,stage,notify,subscribe,audit
require用法
![](https://yqfile.alicdn.com/img_9440c01fccd43f64cdd9199c0e2d5eef.png?x-oss-process=image/resize,w_1400/format,webp)
before
![](https://yqfile.alicdn.com/img_7f4b7aa56fec91b154f847d94b6e7b43.png?x-oss-process=image/resize,w_1400/format,webp)
notify
![](https://yqfile.alicdn.com/img_c92ec48b83377b232259d4cbe695f1b5.png?x-oss-process=image/resize,w_1400/format,webp)
subscribe
![](https://yqfile.alicdn.com/img_8f91488627d0da10b615d17e70e41729.png?x-oss-process=image/resize,w_1400/format,webp)
->先后关系
![](https://yqfile.alicdn.com/img_bfb81c1443608aeb79200ee79c59bd21.png?x-oss-process=image/resize,w_1400/format,webp)
~>通知
![](https://yqfile.alicdn.com/img_d7abd55b8615cf210bb9abe0664fa432.png?x-oss-process=image/resize,w_1400/format,webp)
三段
![](https://yqfile.alicdn.com/img_cd6c7744c5cbb2119efa1493d3104e13.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_080c688b468bd4e1eacf65836807a158.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_8254e3684aa48dda894edd045e9ec99d.png?x-oss-process=image/resize,w_1400/format,webp)
audit审计
![](https://yqfile.alicdn.com/img_54024c9e8705c8f36f8ff70663139267.png?x-oss-process=image/resize,w_1400/format,webp)
默认资源:Exec,Package,
虚拟资源:@ realize <|xxx|>
![](https://yqfile.alicdn.com/img_c1ab8bc6c2cf4520032e9ccee3ae1835.png?x-oss-process=image/resize,w_1400/format,webp)
erb <%= %>
![](https://yqfile.alicdn.com/img_1a36eced777a752e9bdd3d0a6791e1ac.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_494e3802e14577ef529814fecf918725.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_1c27683bf7372ed3c88e60f094e0fcb6.png?x-oss-process=image/resize,w_1400/format,webp)
erb
<% if %>
<% elsif %>
<% else %>
<% end %>
erb each ????? erb 函数
facter:physicalprocessorcount,processorcount,processor0-7,memorysize,memoryfree,swapsize,swapfree
获取内存信息:
![](https://yqfile.alicdn.com/img_fca682b98b0dcc1136cc11c174f851f0.png?x-oss-process=image/resize,w_1400/format,webp)
facter:interfaces,ipaddress,netmask,ipaddress_eth1,netmask_eth1~~,macaddress
operatingsystem,operatingsystemrelease
![](https://yqfile.alicdn.com/img_45aade896a0e17987f91d57b31e463d9.png?x-oss-process=image/resize,w_1400/format,webp)
facter:kernel,kernelmajversion,kernelrelease,kernelversion,selinux,selinux_config_mode,
扩展facter
![](https://yqfile.alicdn.com/img_5e33a4be15b4567fb5b6b0043757802b.png?x-oss-process=image/resize,w_1400/format,webp)
YAML
![](https://yqfile.alicdn.com/img_4919ecf5a840253f855b15100795691d.png?x-oss-process=image/resize,w_1400/format,webp)
puppet ENC功能
puppet dot graphviz功能
puppet stdlib扩展
master和agent多端口使用案例
![](https://yqfile.alicdn.com/img_3c7a08f46feec8af5b5709b55e15949d.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_9bd4e047f70114cfe465847a10caa365.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_32fbca9d5fcaac749965175d2ed4a003.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_420d5de12fee1b66d169591380c30da7.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_ebaec13614a63f179e0e9c44480ebf89.png?x-oss-process=image/resize,w_1400/format,webp)
nginx+passenger 提升master的处理性能
puppet搭建集群:http://jingpin.jikexueyuan.com/article/48475.html
reportdir设置运行报告目录
[agent]
report=true
reportserver=
puppet agent --server puppet.xxxx.com --test --summarize
[master]
reports=store,tagmail,http #开启多个报告处理器
reportfrom=xxx
tagmap=xx/tagmail.conf
![](https://yqfile.alicdn.com/img_1f95d6c6256ecc9a6ec89dcb7a12e3df.png?x-oss-process=image/resize,w_1400/format,webp)
自定义报告处理器
puppet dashboard 安装
puppetdb 安装
puppet MCollective 安装
![](https://yqfile.alicdn.com/img_513ba3916e55629c12874bbc53b4a543.png?x-oss-process=image/resize,w_1400/format,webp)
puppet 部署 MCollective
![](https://yqfile.alicdn.com/img_d13a40d4845edf9b3e7dec2299c317ed.png?x-oss-process=image/resize,w_1400/format,webp)
![](https://yqfile.alicdn.com/img_83b6fe2d0f8149afe569a90df5e5f36b.png?x-oss-process=image/resize,w_1400/format,webp)
HAproxy 搭建puppet 集群