Linux 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3 (2019-09-02) x86_64 GNU/Linuxnode
master 192.168.1.131 host3.super.org
client1 192.168.1.134 host6.super.org
client2 192.168.1.147 host13.super.orgnginx
apt updateweb
apt-get install puppet -ytcp
apt-get install puppetmaster -y測試
apt-get install puppet -yui
systemctl start puppetmaster.servicerest
netstat -nlp |grep 8140
tcp 0 0 0.0.0.0:8140 0.0.0.0:* LISTEN 100268/rubcode
puppet agent --server host3.super.org -v --no-daemonizeserver
查看證書ssl
puppet cert list
推送證書
puppet cert sign --all
查看
root@host3:/etc/puppet/code/environments/production# ls /var/lib/puppet/ssl/ca/signed/ -al
total 32
drwxr-xr-x 2 puppet puppet 4096 Dec 31 10:23 .
drwxr-xr-x 5 puppet puppet 4096 Dec 30 10:59 ..
-rw-r--r-- 1 puppet puppet 1956 Dec 30 14:43 host13.super.org.pem
-rw-r--r-- 1 puppet puppet 2004 Dec 30 10:59 host3.super.org.pem
-rw-r--r-- 1 puppet puppet 1956 Dec 30 14:24 host6.super.org.pem
配置nginx測試
正常你的目錄層級 應該是 /etc/puppet/code/environments/production/
root@host3:/etc/puppet/code/environments/production# cat manifests/site.pp
node 'host6.super.org'{
include nginx::nginx_web
}
node 'host13.super.org'{
include nginx::nginx_web
}
root@host3:/etc/puppet/code/environments/production/modules# mkdir -pv nginx/{manifests,files,lib,templates,tests,spec}
root@host3:/etc/puppet/code/environments/production/modules# cat nginx/manifests/init.pp
class nginx {
package {'nginx':
ensure => installed,
}
}
root@host3:/etc/puppet/code/environments/production/modules# cat nginx/manifests/nginx_web.pp
class nginx::nginx_web inherits nginx {
file {'/etc/nginx/nginx.conf':
ensure => file,
source => 'puppet:///modules/nginx/nginx-web.conf',
mode => '0644',
owner => 'root',
group => 'root',
notify => Service['nginx'],
require => Package['nginx'],
}
service {'nginx':
ensure => running,
}
}
root@host3:/etc/puppet/code/environments/production/modules# cp /etc/nginx/nginx.conf /usr/share/puppet/modules/nginx/files/nginx-web.conf
root@host3:/etc/puppet/code/environments/production/modules# service puppetmaster restart
root@host6:~# puppet agent -t Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Caching catalog for host15.super.org Info: Applying configuration version '1577762968' Notice: /Stage[main]/Nginx/Package[nginx]/ensure: created Notice: Applied catalog in 5.35 seconds root@host6:~# ps aux|grep nginx root 5927 0.0 0.0 159536 1640 ? Ss 11:29 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; www-data 5928 0.0 0.0 159872 3296 ? S 11:29 0:00 nginx: worker process www-data 5929 0.0 0.0 159872 3296 ? S 11:29 0:00 nginx: worker process www-data 5930 0.0 0.0 159872 3296 ? S 11:29 0:00 nginx: worker process www-data 5931 0.0 0.0 159872 3296 ? S 11:29 0:00 nginx: worker process root 5943 0.0 0.0 11108 928 pts/0 S+ 11:29 0:00 grep --color nginx