Puppet自动化部署-前期环境准备(2)

  在安装Puppet环境之前需要配置好机器的基本配置,如规范网络地址IP、hostname,certname认证名称,ntp时间同步等配置完毕,完善的搭建自动化环境。

1.环境介绍

  此处实现部署的环境是两台安装Linux Cento6.7 虚拟机,分别是Master,Agent端,实现简单的C/S架构部署

 

2.针对Master,Agent端配置网络地址

      (1)设置网络IP地址

    此处环境使用的内网网段172.16.29.0/24

 

【Master】

[root@puppet-master ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth1
HWADDR=00:0C:29:C7:D6:71
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=172.16.29.130
NETMASK=255.255.255.0
DNS1=114.114.114.114
GATEWAY=172.16.29.2

 【Agent】
[root@puppet-agent1 ~]#  vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth1
HWADDR=00:0c:29:14:6d:8a
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=172.16.29.129
NETMASK=255.255.255.0
DNS1=114.114.114.114
GATEWAY=172.16.29.2

  

  (2)设置主机名称

【Master】端

[root@puppet-master ~]# vim /etc/hosts
172.16.29.130 puppet-master.nlf.com puppet-master
172.16.29.129 puppet-agent1.nlf.com puppet-agent1

【Agent】端
[root@puppet-agent1 ~]# vim /etc/hosts
172.16.29.130 puppet-master.nlf.com puppet-master
172.16.29.129 puppet-agent1.nlf.com puppet-agent1  

  

 3.安全设置

 

【Selinux】

[root@puppet-master ~]# sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
[root@puppet-agent1 ~]# sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config

【IPtables】
[root@puppet-master ~]# /etc/init.d/iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@puppet-master ~]# chkconfig iptables off

[root@puppet-agent1 ~]# /etc/init.d/iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@puppet-agent1 ~]# chkconfig iptables off

 

  

4.配置本地YUM源

[root@puppet-master ~]# mkdir /mnt/iso
[root@puppet-master ~]# mount /dev/sr0 /mnt/iso/
[root@puppet-master ~]# vim /etc/yum.repos.d/puppet-yum.repo
  [puppet-yum]
  name="puppet yum for cenots6.7"
  baseurl=file:///mnt/iso
  enabled=1
  gpgcheck=0

## Agent端配置同上!!

  

 

5.NTP服务器设置

  (1)查看NTP是否安装

[root@puppet-master ~]# rpm -qa|grep ntp
ntpdate-4.2.6p5-10.el6.centos.1.x86_64
fontpackages-filesystem-1.41-1.1.el6.noarch
ntp-4.2.6p5-10.el6.centos.1.x86_64

## Agent端配置同上!!

 

[root@puppet-master ~]# vim /etc/ntp.conf
  driftfile /var/lib/ntp/drift
  restrict default kod nomodify notrap nopeer noquery
  restrict -6 default kod nomodify notrap nopeer noquery
  restrict 127.0.0.1
  restrict -6 ::1
  server ntp.sjtu.edu.cn iburst
  includefile /etc/ntp/crypto/pw
  keys /etc/ntp/keys

[root@puppet-master ~]# /etc/init.d/ntpd start
Starting ntpd:                                             [  OK  ]

[root@puppet-master ~]# ntpdate ntp.sjtu.edu.cn
21 Dec 11:40:32 ntpdate[22099]: the NTP socket is in use, exiting
[root@puppet-master ~]# chkconfig ntpd on

[root@puppet-master ~]# crontab -l     ###设置同步频率
  */30 * * * * /usr/sbin/ntpdate ntp.sjtu.edu.cn
[root@puppet-master ~]# /etc/init.d/crond restart
Stopping crond:                                            [  OK  ]
Starting crond:                                            [  OK  ]
## Agent端配置同上!!

  至此,Puppet初始环境部署完毕!

 

  

 

  

 

转载于:https://www.cnblogs.com/NGU-PX/p/6206926.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值