puppet 入门

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

puppet入门puppet简介3puppet是什么3Helloworld4puppet安装5debian系发行版安装puppet5redhat系发行版安装puppet5源代码安装puppet6配置c/s模式的puppet试验环境6puppet语法8资源8类和函数10节点11变量和数组12模块13几个常用的资源14file资源14package资源15service资源15exec资源16puppet高级内容17FAQ181第0章2前言2第1章puppet简介1puppet是什么2Figure1.1:puppetstructure123第1章puppet简介4Helloworldfile{/tmp/test:content=hello\n,mode=0644;}package{[gcc,make]:ensure=installed;}再次提醒:不同的资源有不同的属性,但是又有一些属性是所有资源都共有的,例如tag,这种属性叫做元属性。4第2章puppet安装1debian系发行版安装puppet2aptgetinstallpuppetpuppetmasterredhat系发行版安装puppetrpmUvhrelease53.noarch.rpmyuminstallpuppet125第2章puppet安装6源代码安装puppetbase64cgidigest/md5etcfileutilsipaddropensslstrscansysloguriwebrickwebrick/httpsxmlrpctarzxffacter1.5.7.tar.gzcdfacter1.5.7rubyinstall.rbtarzxfpuppet0.25.4.tar.gzcdpuppet0.25.4rubyinstall.rb配置c/s模式的puppet试验环境6第2章puppet安装7aptgetinstallpuppetaptgetinstallpuppetmasterecho192.168.0.10␣server.puppet.com/etc/hosts注意:要在安装软件以前先设置主机名,因为生成证书的时候要把主机名写入证书,如果证书生成好了再改主机名,就连不上,这是很多初学者遇到的问题。puppetdtestserverserver.puppet.compupetcalistpupetcasanodedefault{file{/tmp/temp1.txt:content=hello;}}pupetdtestserverserver.puppet.com7第3章puppet语法资源file{/etc/passwd:name=/etc/passd,owner=root,group=root,mode=644;}file{sshdconfig:name=$operatingsystem?{solaris=/usr/local/etc/ssh/sshd_config,default=/etc/ssh/sshd_config,},owner=root,8第3章puppet语法9group=root,mode=644,}service{sshd:subscribe=File[sshdconfig],}file{[/etc/passwd,/etc/hosts]:owner=root,group=root,mode=644;}File{owner=root,mode=644;}file{/etc/apache2/port.conf:content=80,require=Package[apache2];}package{apache2:9第3章puppet语法10ensure=installed;}类和函数classssh{file{/etc/ssh/sshd_config:source=puppet://$fileserver/ssh/sshd_config.cfg;}package{ssh:ensure=installed;}service{ssh:ensure=running;}}10第3章puppet语法11definesvn_repo($path){exec{/usr/bin/svnadmin␣create␣$path/$title:unless=/bin/test␣d␣$path,}}svn_repo{puppet_repo:path=/var/svn_puppet}svn_repo{other_repo:path=/var/svn_other}12节点3node'host1.example.com'{includessh}node'host2.example.com'{includeapache,mysql,php}12311第3章puppet语法12node'host4.example.com'{$networktype=tele$nagioscheckport=80,22,3306includessh,apache,mysql}变量和数组$test=hello,guysfile{/tmp/test:content=$test;}[apache2,httpd,ssh]definephp::pear(){package{`php${name}:ensure=installed}}php::pear{['ldap','mysql','ps','snmp','sqlite','tidy','xmlrpc']:}12第3章puppet语法13模块13第4章几个常用的资源file资源source=puppet://${fileserver}/lvs/${corp}.${idc}.keepalived.conf14第4章几个常用的资源15file{/etc/squid/squid.conf:mode=0644,content=template(squid/squid.conf.erb);}1cache_mem%=Integer(vmx_memsize.to_i*0.45)%MBvisible_hostname%=fqdn%package资源package{[vim,iproute,xwindowsystem]:ensure=installed;[pppoe,pppoeconf]:ensure=absent;}service资源service{ssh:ensure=running;nfs:ensure=stoped;115第4章几个常用的资源16}exec资源exec{delete␣config:path=/bin:/usr/bin,command=rm␣/etc/ssh/ssh_config;}16第5章puppet高级内容17第6章FAQpuppetdtestserverserver.example.com#发送证书请求puppetcalist#列出所有证书请求puppetcasa#签名所有证书puppetdtestserverserver.example.com#得到证书18第6章FAQ19后记huangmingyouhouqpfrostynovaaaniao999kuuyeeedison7500minxu270175100douzlDanielHounlinewtopppxw2014chifengdywerLiuNan19

1 / 20
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功