1、mkdir /puppet
mkdir /puppet/soft
2、服务端安装dnsmasq:yum install -y dnsmasq
cp /etc/dnsmasq.conf /etc/dnsmasq.conf.bak
echo "">/etc/dnsmasq.conf
3、配置dnsmasq: vi /etc/dnsmasq.conf
resolv-file=/etc/resolv.dnsmasq.conf
strict-order
listen-address=172.16.54.209,127.0.0.1
addn-hosts=/etc/dnsmasq.hosts
cache-size=100
server=114.114.114.114
bogus-nxdomain=114.114.114.114
4、vi /etc/dnsmasq.hosts
172.16.54.209 xx-test
172.16.54.210 yy-test
172.16.54.206 zz-test
5、echo 'nameserver 127.0.0.1' > /etc/resolv.conf
6、echo 'nameserver 218.85.152.99' > /etc/resolv.dnsmasq.conf
echo 'nameserver 218.85.157.99'>>/etc/resolv.dnsmasq.conf
7、 firewall-cmd --add-port=53/tcp --permanent
firewall-cmd --reload
service dnsmasq start
chkconfig dnsmasq on
8、#安装组件
yum install -y ruby-devel ruby-libs rubygems libcurl-devel httpd httpd-devel apr-util-devel apr-devel mod_ssl gcc-c++ gcc openssl-devel
9、服务端安装puppet-server
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
yum install -y puppet-server puppet openssl* gcc make
service puppetmaster start
chkconfig puppetmaster on
firewall-cmd --add-port=8140/tcp --permanent
firewall-cmd --reload
echo "">/etc/puppet/autosign.conf
10、客户端安装puppet:
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
yum install -y puppet openssl
service puppet start
chkconfig puppet on
firewall-cmd --add-port=8140/tcp --permanent
firewall-cmd --reload
设置DNS为puppetmaster的地址
echo "nameserver 172.16.54.209">/etc/resolv.conf
service network restart
签发证书: puppet agent --server puppetmaster --test
11、windows安装
安装ruby
rubyinstaller-1.9.3-p551.exe
安装puppet: puppet-3.7.1-x64.msi
设置DNS为puppetmaster的地址
设置DNS 172.16.54.209
172.16.54.209 xxxx 写到 C:\Windows\System32\drivers\etc
签发证书: puppet agent --server puppetmaster --test
所有的配置文件中添加插件同步
[main]
pluginsync = true
12、在puppetmaster上添加/etc/dnsmasq.hosts,新的两台客户端记录
添加puppetmaster和两台客户端的地址到/etc/hosts
签发证书:puppet cert --sign --all
13、服务端安装svn\httpd:
yum install -y zlib expat-devel httpd httpd-devel
cd /puppet/soft
wget https://archive.apache.org/dist/subversion/subversion-1.7.7.tar.gz
wget http://sqlite.org/sqlite-autoconf-3071401.tar.gz
wget http://www.webdav.org/neon/neon-0.29.6.tar.gz
wget ftp://ftp.pcre.org/pub/pcre/pcre-8.42.tar.bz2
wget http://mirror.bit.edu.cn/apache//apr/apr-1.6.5.tar.gz
wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar zxvf subversion-1.7.7.tar.gz
tar zxvf sqlite-autoconf-3071401.tar.gz
tar zxvf neon-0.29.6.tar.gz
tar jxvf pcre-8.42.tar.bz2
tar zxvf apr-1.6.5.tar.gz
tar zxvf apr-util-1.6.1.tar.gz
cd sqlite-autoconf-3071401
./configure --prefix=/usr/local/sqlite&&make && make install&&cd ..
cd apr-1.6.5
./configure --prefix=/usr/local/apr&&make&&make install&&cd ..
cd apr-util-1.6.1
./configure --with-apr=/usr/local/apr --prefix=/usr/local/apr-util&&make&&make install&&cd ..
cd neon-0.29.6/
./configure --prefix=/usr/local/neon --with-ssl --enable-shared&&make && make install && cd ..
cd pcre-8.42
./configure --prefix=/usr/local/pcre&&make&&make install&&cd ..
cd subversion-1.7.7
./configure --with-apxs --with-ssl --with-sqlite=/usr/local/sqlite --prefix=/usr/local/subversion --with-openssl --with-neon=/usr/local/neon --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util&&make&&make install&&cd ..
cd /usr/local/subversion/bin
./svnadmin create /puppet/svn
chown -R apache /puppet/svn
chmod -R 755 /puppet/svn
ln -s /usr/local/subversion/bin/{svn,svnserve} /usr/local/bin
svnserve -d -r /puppet/svn
添加SVN账号密码,检测
vi /puppet/svn/conf/passwd
svnadmin = yourpassword
修改httpd.conf
vi /etc/httpd/conf/httpd.conf
Listen 80
LoadModule dav_module /usr/lib64/httpd/modules/mod_dav.so
LoadModule dav_svn_module /usr/lib64/httpd/modules/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib64/httpd/modules/mod_authz_svn.so
Listen 8080
<VirtualHost *:8080>
<Location /svn>
DAV svn
SVNPath /puppet/svn
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /puppet/svn_passwd
Require valid-user
AuthzSVNAccessFile /puppet/svn_access
</Location>
</VirtualHost>
保存,启动httpd
/usr/bin/htpasswd -bc /puppet/svn_passwd puppet xmrbi3967968@
/usr/bin/htpasswd -bm /puppet/svn_passwd svnadmin xmrbi3967968@
chmod 777 /puppet/svn_passwd
chmod -R 777 /puppet/svn
service httpd start
svn co svn://localhost/ --username svnadmin --password yourpassword /puppet/svn
添加权限
vi /puppet/svn_access
[groups]
admins=puppet
[/]
@admins=rw
*=
关闭svnserve
pkill svnserve
导入版本库
svn import /etc/puppet http://172.16.54.209:8080/svn -m "import puppet" --username puppet --password password --no-auth-cache
rm -fr /etc/puppet
svn co http://172.16.54.209:8080/svn /etc/puppet --username puppet --password yourpassword --no-auth-cache
cd /puppet/svn/hooks/
cp post-commit.tmpl post-commit
chmod -R 777 /etc/puppet
设置钩子
vi post-commit
export LANG=en_US.UTF-8
SVN=/usr/local/subversion/bin/svn
PUPPET_DIR=/etc/puppet
PUPPET_DIR --username puppet --password yourpassword --no-auth-cache
service puppetmaster restart
dnsmasq速度有点慢
证书的注销
puppet cert revoke zabbix.ewin.com
puppet cert revoke --all
service puppetmaster restart
证书删除:
puppet cert --clean zabbix.ewin.com #单个删除
puppet cert --clean --all #全部删除