副标题[/!--empirenews.page--]

Puppet工作原理
让管理员只集中于要管理的目标,而忽视实现的细节。puppet既可以在单机上使用,也可以以C/S结构使用。在大规模使用puppet的情况下,通常使用C/S结构,在这种结构中puppet客户端只运行puppetclient,Puppet服务端只运行puppetmaster。具体的工作流程如图所示:

环境
使用四台服务器模拟搭建puppet环境,拓扑图如下所示:

环境表

实验步骤
1.搭建Puppet Master
(1)规划三台服务器主机名
- [root@localhost ~]# vim /etc/hostname
- master.test.cn
- [root@localhost ~]# vim /etc/hosts
- 192.168.126.138 master.test.cn
- 192.168.126.148 client01.test.cn
- 192.168.126.158 client02.test.cn
(2)服务器时间同步
由于puppet需要使用SSL证书,依赖时间同步,所以需要搭建NTP服务器
1)搭建NTP Server
- [root@localhost ~]# yum install ntp -y
- [root@localhost ~]# vim /etc/ntp.conf
-
- 添加以下两行:server 127.127.1.0 #指定本地作为时间源服务器
- fudge 127.127.1.0 stratum 8
其作用是当 /etc/ntp.conf 中定义的server都不可用时,将使用local时间作为NTP服务提供给NTP客户端。
2)启动ntp服务并设置开机自启动
- [root@localhost ~]# systemctl stop firewalld.service
- [root@localhost ~]# systemctl disable firewalld.service
- [root@localhost ~]# setenforce 0
- [root@localhost ~]# systemctl start ntpd.service
- [root@localhost ~]# systemctl enable ntpd.service
- [root@localhost ~]# ntpstat #同步
- synchronised to NTP server (193.228.143.13) at stratum 3
- time correct to within 517 ms
- polling server every 64 s
3)puppetmaster作为NTP客户端的配置
- [root@master ~]# yum install ntpdate -y
- [root@master ~]# ntpdate 192.168.126.159
- 6 Aug 09:45:03 ntpdate[3488]: adjust time server 192.168.126.159 offset -0.072288 sec #调整时间服务器192.168.126.159偏移-0.072288秒
4)配置YUM源
- [root@master ~]# yum install epel-release -y
-
- [root@master ~]# yum install puppet-server -y #安装puppet服务端
5)启动puppet主程序
- [root@master ~]# systemctl stop firewalld.service
- [root@master ~]# systemctl disable firewalld.service
- [root@master ~]# setenforce 0
- [root@master ~]# systemctl start puppetmaster.service
- [root@master ~]# systemctl enable puppetmaster.service
2.搭建puppetclient(两台客户端配置一样)
1)通过域名ping通puppetmaster
- [root@client01 ~]# ping master.test.cn
- PING master.test.cn (192.168.126.138) 56(84) bytes of data.
- 64 bytes from master.test.cn (192.168.126.138): icmp_seq=1 ttl=64 time=1.06 ms
- 64 bytes from master.test.cn (192.168.126.138): icmp_seq=2 ttl=64 time=3.27 ms
- 64 bytes from master.test.cn (192.168.126.138): icmp_seq=3 ttl=64 time=0.382 ms
- 64 bytes from master.test.cn (192.168.126.138): icmp_seq=4 ttl=64 time=0.660 ms
(编辑:好传媒网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|