- NETWORKING=yes
- NETWORKING_IPV6=no
- HOSTNAME=puppet.test.com
- yum -y install *gcc*
- yum -y install openssl
- mkdir -p /fgn/soft/ && cd /fgn/soft/
- wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p334.tar.gz
- tar zxvfruby-1.8.7-p334.tar.gz
- cd ruby-1.8.7-p334
- ./configure&& make && make install
- for i in base64cgi digest/md5 etc fileutils ipaddr openssl strscan syslog uri webrick webrick/httpsxmlrpc/client
- do
- /usr/local/bin/ruby-r$i -e "puts:installed"
- done
- cd ..
- wget http://downloads.puppetlabs.com/facter/facter-1.5.8.tar.gz
- tar zxvf facter-1.5.8.tar.gz
- cd facter-1.5.8
- ruby install.rb
- cd ..
- wget http://downloads.puppetlabs.com/puppet/puppet-2.6.7.tar.gz
- tar zxvf puppet-2.6.7.tar.gz
- cd puppet-2.6.7
- ruby install.rb --full --bindir=/usr/bin --sbindir=/usr/sbin
- if [ -e/etc/SuSE-release ]; then
- cp conf/suse/server.init /etc/init.d/puppetmasterd
- else
- cp conf/redhat/server.init /etc/init.d/puppetmasterd
- fi
- groupadd puppet
- useradd -g puppetpuppet -M
- chmod +x/etc/init.d/puppetmasterd
- mkdir -p /var/lib/puppet/rrd
- chown puppet:puppet /var/lib/puppet/rrd/
- mkdir -p /var/run/puppet/
- chown puppet:puppet /var/run/puppet/
- chkconfig --add puppetmasterd
- chkconfig puppetmasterd on
- /etc/init.d/puppetmasterdstart
- if [ -e/etc/SuSE-release ]; then
- cp conf/suse/client.init /etc/init.d/puppetd
- else
- cp conf/redhat/client.init /etc/init.d/puppetd
- fi
- cat <<EOF> /etc/puppet/puppet.conf
- [main]
- ssl_client_header =SSL_CLIENT_S_DN
- ssl_client_verify_header= SSL_CLIENT_VERIFY
- [agent]
- listen = true
- report = true
- show_diff=true
- runinterval = 300
- server = puppet.test.com
- ca_port = 8141
- EOF
- cat<<EOF> /etc/puppet/namespaceauth.conf
- [puppetrunner]
- allow cloudcenter.test.net
- EOF
- chmod +x/etc/init.d/puppetd
- chkconfig --add puppetd
- chkconfig puppet on
- ln -sf/usr/local/sbin/puppetd /usr/sbin/puppetd
- /etc/init.d/puppetd restart
- echo "192.168.0.1 puppet.test.com puppet">> /etc/hosts //IP为中心端地址
- cat<<EOF>/etc/puppet/auth.conf
- path /
- auth no
- allow *
- EOF
- cat<<EOF>/etc/puppet/autosign.conf
- *.test.net
- EOF
- cat <<EOF>/etc/puppet/fileserver.conf
- [files]
- path/etc/puppet/manifests/files
- allow *
- [moudles]
- path/etc/puppet/modules
- allow *.test.net
- EOF
- cat<<EOF> /etc/puppet/puppet.conf
- [main]
- ssl_client_header = SSL_CLIENT_S_DN
- ssl_client_verify_header = SSL_CLIENT_VERIFY
- [master]
- fileserverconfig = /etc/puppet/fileserver.conf
- reports = http
- reporturl = http://192.168.0.1:4000/reports
- masterlog = /var/lib/puppet/log/puppetmaster.log
- logdir = /var/lib/puppet/log
- puppetdlog = /var/lib/puppet/log/puppetd.log
- EOF
- echo "err:[email protected]" > /etc/puppet/tagmail.conf
- mkdir /etc/puppet/modules
- cd /fgn/soft/
- wget http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz
- tar zxvf rubygems-1.6.2.tgz
- cd rubygems-1.6.2
- ruby setup.rb
- gem installmongrel
- cd /fgn/soft/
- wget http://nginx.org/download/nginx-1.0.12.tar.gz
- tar zxvfnginx-1.0.12.tar.gz
- cd nginx-1.0.12
- ./configure--with-http_stub_status_module --with-http_ssl_module
- make && make install
- useradd daemon
- user daemon daemon;
- worker_processes 4;
- worker_rlimit_nofile 65535;
- error_log /var/log/nginx-puppet.log notice;
- pid /var/run/nginx-puppet.pid;
- events {
- use epoll;
- worker_connections 32768;
- }
- http {
- sendfile on;
- tcp_nopush on;
- keepalive_timeout 300;
- tcp_nodelay on;
- ssl on;
- ssl_session_timeout 5m;
- ssl_certificate /etc/puppet/ssl/certs/puppet.test.com.pem;
- ssl_certificate_key /etc/puppet/ssl/private_keys/puppet.test.com.pem;
- ssl_client_certificate /etc/puppet/ssl/ca/ca_crt.pem;
- ssl_crl /etc/puppet/ssl/ca/ca_crl.pem;
- ssl_ciphers SSLv2:-LOW:-EXPORT:RC4+RSA;
- ssl_session_cache shared:SSL:8m;
- upstream puppetmaster {
- server 127.0.0.1:18140;
- server 127.0.0.1:18141;
- server 127.0.0.1:18142;
- server 127.0.0.1:18143;
- }
- upstream dashboard {
- server 127.0.0.1:4000;
- }
- log_format download '$remote_addr, $http_x_forwarded_for $remote_user [$time_local] $request_time $host "$request_method $request_uri $server_protocol" $status - $body_bytes_sent $bytes_sent $sent_http_content_length "$sent_http_content_Range" "$http_referer" "$http_user_agent" $sent_http_x_cache $sent_http_content_type' " up_addr:$upstream_addr" " up_resp:$upstream_response_time" "s" " up_status:$upstream_status" ;
- access_log logs/access.log download;
- #+--------------------------------------------------------------------------------------------+
- server {
- listen 8140;
- server_name puppet.test.com;
- ssl_verify_client on;
- root /etc/puppet;
- # Ask the puppetmaster for everything else
- # File sections
- location /production/file_content/files/ {
- types { }
- default_type application/x-raw;
- alias /etc/puppet/manifests/files/;
- }
- # Modules files sections
- location ~ /production/file_content/modules/.+/ {
- root /etc/puppet/modules;
- types { }
- default_type application/x-raw;
- rewrite ^/production/file_content/modules/([^/]+)/(.+)$ /$1/files/$2 break;
- }
- location / {
- proxy_pass http://puppetmaster;
- proxy_redirect off;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Client-Verify SUCCESS;
- proxy_set_header X-Client-DN $ssl_client_s_dn;
- proxy_set_header X-SSL-Subject $ssl_client_s_dn;
- proxy_set_header X-SSL-Issuer $ssl_client_i_dn;
- proxy_read_timeout 65;
- }
- }#server end
- server {
- listen 8141;
- ssl_verify_client off;
- root /etc/puppet;
- access_log /usr/local/nginx/logs/access-8141.log download;
- # File sections
- location /production/file_content/files/ {
- types { }
- default_type application/x-raw;
- alias /etc/puppet/manifests/files/;
- }
- # Modules files sections
- location ~ /production/file_content/modules/.+/ {
- root /etc/puppet/modules;
- types { }
- default_type application/x-raw;
- rewrite ^/production/file_content/modules/([^/]+)/(.+)$ /$1/files/$2 break;
- }
- location / {
- proxy_pass http://puppetmaster;
- proxy_redirect off;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Client-Verify FAILURE;
- proxy_set_header X-Client-DN $ssl_client_s_dn;
- proxy_set_header X-SSL-Subject $ssl_client_s_dn;
- proxy_set_header X-SSL-Issuer $ssl_client_i_dn;
- proxy_read_timeout 65;
- }
- }
- }#http end
- # Location of the main manifest
- #PUPPETMASTER_MANIFEST=/etc/puppet/manifests/site.pp
- # Where to log general messages to.
- # Specify syslog to send log messages to the system log.
- PUPPETMASTER_LOG=/var/log/puppet/puppetmaster.log
- PUPPETMASTER_PORTS=( 18140 18141 18142 18143 )
- PUPPETMASTER_EXTRA_OPTS="--servertype=mongrel --ssl_client_header=HTTP_X_SSL_SUBJECT"
- # You may specify other parameters to the puppetmaster here
- #PUPPETMASTER_EXTRA_OPTS=--noca
- /etc/init.d/puppetmasterdrestart
- /usr/local/nginx/sbin/nginx
- cat<<EOF> /etc/puppet/manifests/site.pp
- node default {
- file {"/tmp/temp1.txt": content => "hello,first puppetmanifest"; }
- }
- EOF
- puppetd --test --serverpuppet.test.com