timedatectl set-ntp true
hostnamectl set-hostname master #服務端 hostnamectl set-hostname slave #客戶端
同時修改/etc/hosts文件以下:node
cat /etc/hosts 127.0.0.1 localhost localhost.localdomain master ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 1.1.1.1 master 2.2.2.2 slave
修改/etc/sysconfig/networklinux
cat /etc/sysconfig/network HOSTNAME=master #服務端 # HOSTNAME=slave 客戶端
systemctl stop filewall setenfoce 0
1.因爲puppet在yum中沒有puppet源,因此須要下載相應的擴展rpm包。shell
wget https://yum.puppetlabs.com/el/7/products/x86_64/puppetlabs-release-7-10.noarch.rpm rpm -ivh puppetlabs-release-7-10.noarch.rpm yum -y update
2.安裝puppet以及相關組件vim
yum -y install factor ruby puppet-server #服務端 yum -y install factor ruby puppet #客戶端
3.客戶端配置
修改/etc/puppet/puppet.confruby
cat /etc/puppet/puppet.conf #添加下面三行 certname = slave server = master report = true
4.啓動puppetdom
systemctl start puppet puppetmaster #服務端 systemctl start puppet #客戶端
5.測試
在客戶端測試:ide
puppet agent --server=master --verbose --no-daemonize --debug
結果爲:Notice: Starting Puppet client version 3.8.7 則成功
6.在服務端容許slave證書測試
puppet cert list --all #前面沒加+號的說明還沒認證 puppet cert sign slave #認證客戶端
7.測試用例debug
vim /etc/puppet/manifests/site.pp # 在服務端編寫 node default { file { "/tmp/helloworld.txt" : content => "Hello World!", } }
# 客戶端 puppet agent --test
提示爲:(成功)
code