1
|
[root@puppetmaster ~]
# yum install -y ruby ruby-libs ruby-shadow
|
1
2
3
|
[root@puppetmaster ~]# tar zxvf facter-1.7.3.tar.gz
[root@puppetclient1 ~]# cd facter-1.7.3
[root@puppetmaster facter-1.7.3]# ruby install.rb
|
1
2
3
4
5
6
7
|
[root@puppetmaster puppet-3.3.1]
# useradd -s /sbin/nologin puppet
[root@puppetmaster ~]
# tar zxvf puppet-3.3.1.tar.gz
[root@puppetclient1 ~]
# cd puppet-3.3.1
[root@puppetclient1 puppet-3.3.1]
# ruby install.rb
[root@puppetmaster puppet-3.3.1]
# cp ext/redhat/puppet.conf /etc/puppet/
[root@puppetmaster puppet-3.3.1]
# cp ext/redhat/server.init /etc/init.d/puppetmaster
[root@puppetmaster puppet-3.3.1]
# chmod +x /etc/init.d/puppetmaster
|
1
2
3
|
[root@puppetmaster ~]
# vi /etc/puppet/puppet.conf
[main]
#在main里面添加puppet服务端主机名
server = puppetmaster.com
|
1
2
3
|
[root@puppetmaster puppet-3.3.1]
# chkconfig --add puppetmaster
[root@puppetmaster puppet-3.3.1]
# chkconfig puppetmaster on
[root@puppetmaster puppet-3.3.1]
# service puppetmaster start
|
1
|
[root@puppetclient1 ~]
# yum install -y ruby ruby-libs ruby-shadow
|
1
2
3
|
[root@puppetclient1 ~]# tar zxvf facter-
1.7
.
3
.tar.gz
[root@puppetclient1 ~]# cd facter-
1.7
.
3
[root@puppetclient1 facter-
1.7
.
3
]# ruby install.rb
|
1
2
3
4
5
6
|
[root@puppetclient1 puppet-3.3.1]
# useradd -s /sbin/nologin puppet
[root@puppetclient1 ~]
# tar zxvf puppet-3.3.1.tar.gz
[root@puppetclient1 puppet-3.3.1]
# ruby install.rb
[root@puppetclient1 puppet-3.3.1]
# cp ext/redhat/puppet.conf /etc/puppet/puppet.conf
[root@puppetclient1 puppet-3.3.1]
# cp ext/redhat/client.init /etc/init.d/puppet
[root@puppetclient1 puppet-3.3.1]
# chmod +x /etc/init.d/puppet
|
1
2
3
|
[root@puppetclient1 ~]
# vi /etc/puppet/puppet.conf
[main]
#在main里面添加puppet服务端主机名
server = puppetmaster.com
|
1
2
3
4
|
[root@puppetclient1 puppet-3.3.1]
# chkconfig --add puppet
[root@puppetclient1 puppet-3.3.1]
# chkconfig puppet on
[root@puppetclient1 puppet-3.3.1]
# service puppet start
[root@puppetclient1 puppet-3.3.1]
# netstat -tupln | grep 8140
|
1
2
3
4
5
6
|
[root@puppetclient1 ~]
# puppet agent --test
Info: Creating a new SSL key
for
puppetclient1.com
Info: Caching certificate
for
ca
Info: Creating a new SSL certificate request
for
puppetclient1.com
Info: Certificate Request fingerprint (SHA256): 7E:10:48:3F:3C:D4:13:BA:BF:66:ED:86:52:92:19:05:1E:D2:3A:CD:06:67:27:80:60:D6:54:66:0E:33:F7:C7
Exiting; no certificate found and waitforcert is disabled
|
1
2
3
|
[root@puppetmaster ~]
# puppet cert list #加--all查看所有
"puppetclient1.com"
(SHA256) 7E:10:48:3F:3C:D4:13:BA:BF:66:ED:86:52:92:19:05:1E:D2:3A:CD:06:67:27:80:60:D6:54:66:0E:33:F7:C7
"puppetclient1.com.com"
(SHA256) 46:B6:95:A6:1B:6A:FD:83:E4:1C:72:D4:5C:3C:B5:EF:3D:F7:43:2C:09:CF:00:B8:44:18:E4:3E:B3:DC:6F:FD
|
1
2
3
|
[root@puppetmaster ~]
# puppet cert sign puppetclient1.com #主机名改为--all,是受理所有
Notice: Signed certificate request
for
puppetclient1.com
Notice: Removing
file
Puppet::SSL::CertificateRequest puppetclient1.com at
'/var/lib/puppet/ssl/ca/requests/puppetclient1.com.pem'
|
1
|
[root@puppetclient1 ~]
# puppet agent --test
|
1
|
Error:
/File
[
/var/lib/puppet/lib
]: Could not evaluate: Could not retrieve information from environment production
source
(s) puppet:
//puppetmaster
.com
/plugins
|
1
|
[root@puppetmaster ~]
# puppet cert clean puppetclient1.com
|
1
2
3
4
5
6
7
8
|
[root@puppetmaster ~]
# vi /etc/puppet/manifests/site.pp #修改后立即,无需重启
node
'puppetclient1.com'
{
#指定某台,也可以不写为所有
file
{
"/tmp/test.txt"
:
content=>
"hello,puppet test\n"
;
#source=> "puppet://$puppetserver/files/httpd.conf"
#也可以这样分发一个配置文件
}
}
|
1
2
3
|
[root@puppetclient1 ~]
# puppet agent --test
[root@puppetclient1 ~]
# ls /tmp/
test
.txt
|