puppet server 安装
rpm-ivhhttp://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-6.noarch.rpm yuminstallpuppet-server-y
puppet server puppet.conf 配置:
cat/etc/puppet/puppet.conf [main] #ThePuppetlogdirectory. #Thedefaultvalueis'$vardir/log'. logdir=/var/log/puppet #WherePuppetPIDfilesarekept. #Thedefaultvalueis'$vardir/run'. rundir=/var/run/puppet #WhereSSLcertificatesarekept. #Thedefaultvalueis'$confdir/ssl'. ssldir=$vardir/ssl autosign=$confdir/autosign.conf{mode=664} [agent] #Thefileinwhichpuppetdstoresalistoftheclasses #associatedwiththeretrievedconfiguratiion.Canbeloadedin #theseparate``puppet``executableusingthe``--loadclasses`` #option. #Thedefaultvalueis'$confdir/classes.txt'. classfile=$vardir/classes.txt #Wherepuppetdcachesthelocalconfiguration.An #extensionindicatingthecacheformatisaddedautomatically. #Thedefaultvalueis'$confdir/localconfig'. localconfig=$vardir/localconfig [development] modulepath=/etc/puppet/modules:/usr/share/puppet/modules config_version= [production] modulepath=/etc/puppet/modules:/usr/share/puppet/modules config_version=
Unicorn 安装配置
yuminstallruby-develmakegcc geminstallunicornrack cp/usr/share/puppet/ext/rack/config.ru/etc/puppet/ vi/etc/puppet/unicorn.conf worker_processes8 working_directory"/etc/puppet" listen'/var/run/puppet/puppetmaster_unicorn.sock',:backlog=>512 timeout120 pid"/var/run/puppet/puppetmaster_unicorn.pid" preload_apptrue ifGC.respond_to?(:copy_on_write_friendly=) GC.copy_on_write_friendly=true end before_forkdo|server,worker| old_pid="#{server.config[:pid]}.oldbin" ifFile.exists?(old_pid);server.pid!=old_pid begin Process.kill("QUIT",File.read(old_pid).to_i) rescueErrno::ENOENT,Errno::ESRCH #someoneelsedidourjobforus end end end
调试:
unicorn-c/etc/puppet/unicorn.conf I,[2014-08-15T08:55:36.452577#9031]INFO--:RefreshingGemlist I,[2014-08-15T08:55:38.779972#9031]INFO--:unlinkingexistingsocket=/var/run/puppet/puppetmaster_unicorn.sock I,[2014-08-15T08:55:38.780441#9031]INFO--:listeningonaddr=/var/run/puppet/puppetmaster_unicorn.sockfd=6 I,[2014-08-15T08:55:38.787469#9059]INFO--:worker=0spawnedpid=9059 I,[2014-08-15T08:55:38.790368#9059]INFO--:worker=0ready I,[2014-08-15T08:55:38.792410#9060]INFO--:worker=1spawnedpid=9060 I,[2014-08-15T08:55:38.795405#9060]INFO--:worker=1ready I,[2014-08-15T08:55:38.796387#9061]INFO--:worker=2spawnedpid=9061 I,[2014-08-15T08:55:38.799071#9061]INFO--:worker=2ready I,[2014-08-15T08:55:38.801353#9062]INFO--:worker=3spawnedpid=9062 I,[2014-08-15T08:55:38.804052#9062]INFO--:worker=3ready I,[2014-08-15T08:55:38.805570#9063]INFO--:worker=4spawnedpid=9063 I,[2014-08-15T08:55:38.808220#9063]INFO--:worker=4ready I,[2014-08-15T08:55:38.810281#9064]INFO--:worker=5spawnedpid=9064 I,[2014-08-15T08:55:38.812904#9064]INFO--:worker=5ready I,[2014-08-15T08:55:38.814869#9065]INFO--:worker=6spawnedpid=9065 I,[2014-08-15T08:55:38.817497#9065]INFO--:worker=6ready I,[2014-08-15T08:55:38.817731#9031]INFO--:masterprocessready I,[2014-08-15T08:55:38.819580#9066]INFO--:worker=7spawnedpid=9066 I,[2014-08-15T08:55:38.822096#9066]INFO--:worker=7ready
按ctrl+c结束
编写启动脚本
vi/etc/init.d/puppet-unicorn #!/bin/bash #unicorn-puppet #chkconfig:-9802 # #description:Enablesperiodicsystemconfigurationchecksthroughunicorn-puppet. #processname:unicorn-puppet #Sourcefunctionlibrary. ./etc/rc.d/init.d/functions lockfile=/var/lock/puppetmaster-unicorn pidfile=/var/run/puppet/puppetmaster_unicorn.pid RETVAL=0 DAEMON=/usr/bin/unicorn DAEMON_OPTS="-D-c/etc/puppet/unicorn.conf" start(){ echo-n$"Startingpuppetunicorn:" daemon$DAEMON$DAEMON_OPTS RETVAL=$? echo [$RETVAL=0]&&touch${lockfile} return$RETVAL } stop(){ echo-n$"Stoppingpuppetunicorn:" kill`cat$pidfile` RETVAL=$? [$RETVAL-eq0]&&rm-f{$lockfile}{$pidfile} [$RETVAL-eq0]&&echo_success||echo_failure echo return$RETVAL } restart(){ stop start } usage(){ echo"Usage:$0{start|stop|restart}"; return3 } case"$1"in start) start ;; stop) stop ;; restart) restart ;; *) usage ;; esac exit$RETVAL
chmod+x/etc/init.d/puppet-unicorn chkconfigpuppet-unicornon
配置nginx
vi/etc/nginx/conf.d/puppets-unicorn upstreampuppetmaster_unicorn{ serverunix:/var/run/puppet/puppetmaster_unicorn.sockfail_timeout=0; } server{ listen8140; sslon; ssl_session_timeout5m; ssl_certificate/var/lib/puppet/ssl/certs/puppet.test.com.pem; ssl_certificate_key/var/lib/puppet/ssl/private_keys/puppet.test.com.pem; ssl_client_certificate/var/lib/puppet/ssl/ca/ca_crt.pem; ssl_ciphersSSLv2:-LOW:-EXPORT:RC4+RSA; ssl_verify_clientoptional; root/usr/share/empty; proxy_set_headerHost$host; proxy_set_headerX-Real-IP$remote_addr; proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for; proxy_set_headerX-Client-Verify$ssl_client_verify; proxy_set_headerX-Client-DN$ssl_client_s_dn; proxy_set_headerX-SSL-Issuer$ssl_client_i_dn; proxy_read_timeout120; location/{ proxy_passhttp://puppetmaster_unicorn; proxy_redirectoff; } } /etc/init.d/nginxstart chkconfignginxon
参考网址:
https://linuxmoz.com/rhel-centos-install-puppet-nginx-unicorn/
http://projects.puppetlabs.com/projects/1/wiki/using_unicorn
相关文章
标签:系统运维