Deployment and testing for cloud management tool puppet
System Environment:
650) this. width = 650; "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131227/1U1405Z6-0.jpg "/>
[root@rhel6u3-102 puppet]# uname -r
2.6.32-279.el6.x86_64
[root@rhel6u3-102 puppet]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
1. Preparations 1. The host name can be resolved to the DNS or the hosts file can be resolved to each other) puppet master (rhel6u3-102.rsyslog.org 192.168.100.102) puppet agent node rhel6u3-207.rsyslog.org 192.168.100.207) 2. the system time must be consistent. Note: The installation package has been downloaded locally, and yum source 2 has been configured. Install the puppet server master.
yum install ruby ruby-libs ruby-shadow compat-readline5 libselinux-ruby augeas-libs
rpm -ivh facter-1.6.6-1.el6.x86_64.rpm puppet-2.6.18-3.el6.noarch.rpm puppet-server-2.6.18-3.el6.noarch.rpm ruby-augeas-0.4.1-1.el6.x86_64.rpm ruby-mysql-2.8.2-1.el6.x86_64.rpm ruby-shadow-1.4.1-13.el6.x86_64.rpm
Client node slave does not require puttet-master)
yum install ruby ruby-libs ruby-shadow compat-readline5 libselinux-ruby augeas-libs
rpm -ivh facter-1.6.6-1.el6.x86_64.rpm puppet-2.6.18-3.el6.noarch.rpm ruby-augeas-0.4.1-1.el6.x86_64.rpm ruby-mysql-2.8.2-1.el6.x86_64.rpm ruby-shadow-1.4.1-13.el6.x86_64.rpm
3. initialize the puppet master (rhel6u3-102.rsyslog.org) configuration file path/etc/puppet/view the configuration file method:
sed -e '/#/d' -e '/^$/d' puppet.conf
You can use the following command to generate a more detailed configuration file.
#puppetmasterd --genconfig >puppet.conf.out
[root@rhel6u3-102 puppet]# sed -e '/#/d' -e '/^$/d' puppet.conf.out
[master]
ssldir = /var/lib/puppet/ssl
factdest = /var/lib/puppet/facts/
privatekeydir = /var/lib/puppet/ssl/private_keys
rundir = /var/run/puppet
hostcsr = /var/lib/puppet/ssl/csr_rhel6u3-102.rsyslog.org.pem
hostpubkey = /var/lib/puppet/ssl/public_keys/rhel6u3-102.rsyslog.org.pem
plugindest = /var/lib/puppet/lib
inventory_terminus = yaml
publickeydir = /var/lib/puppet/ssl/public_keys
factsource = puppet://puppet/facts/
privatedir = /var/lib/puppet/ssl/private
logdir = /var/log/puppet
libdir = /var/lib/puppet/lib
statedir = /var/lib/puppet/state
hostcert = /var/lib/puppet/ssl/certs/rhel6u3-102.rsyslog.org.pem
localcacert = /var/lib/puppet/ssl/certs/ca.pem
pluginsource = puppet://puppet/plugins
certdir = /var/lib/puppet/ssl/certs
factpath = /var/lib/puppet/lib/facter:/var/lib/puppet/facts
httplog = /var/log/puppet/http.log
requestdir = /var/lib/puppet/ssl/certificate_requests
passfile = /var/lib/puppet/ssl/private/password
hostprivkey = /var/lib/puppet/ssl/private_keys/rhel6u3-102.rsyslog.org.pem
hostcrl = /var/lib/puppet/ssl/crl.pem
authconfig = /etc/puppet/namespaceauth.conf
localconfig = /var/lib/puppet/state/localconfig
client_datadir = /var/lib/puppet/client_data
reportserver = puppet
inventory_server = puppet
ca_server = puppet
lastrunreport = /var/lib/puppet/state/last_run_report.yaml
node_name_value = rhel6u3-102.rsyslog.org
statefile = /var/lib/puppet/state/state.yaml
clientbucketdir = /var/lib/puppet/clientbucket
classfile = /var/lib/puppet/state/classes.txt
report_server = puppet
inventory_port = 8140
ca_port = 8140
puppetdlockfile = /var/lib/puppet/state/puppetdlock
splaylimit = 1800
clientyamldir = /var/lib/puppet/client_yaml
puppetdlog = /var/log/puppet/puppetd.log
report_port = 8140
lastrunfile = /var/lib/puppet/state/last_run_summary.yaml
graphdir = /var/lib/puppet/state/graphs
capub = /var/lib/puppet/ssl/ca/ca_pub.pem
csrdir = /var/lib/puppet/ssl/ca/requests
autosign = /etc/puppet/autosign.conf
cert_inventory = /var/lib/puppet/ssl/ca/inventory.txt
cacert = /var/lib/puppet/ssl/ca/ca_crt.pem
cacrl = /var/lib/puppet/ssl/ca/ca_crl.pem
signeddir = /var/lib/puppet/ssl/ca/signed
serial = /var/lib/puppet/ssl/ca/serial
ca_name = Puppet CA: rhel6u3-102.rsyslog.org
cakey = /var/lib/puppet/ssl/ca/ca_key.pem
caprivatedir = /var/lib/puppet/ssl/ca/private
capass = /var/lib/puppet/ssl/ca/private/ca.pass
cadir = /var/lib/puppet/ssl/ca
railslog = /var/log/puppet/rails.log
dblocation = /var/lib/puppet/state/clientconfigs.sqlite3
rest_authconfig = /etc/puppet/auth.conf
modulepath = /etc/puppet/modules:/usr/share/puppet/modules
yamldir = /var/lib/puppet/yaml
reportdir = /var/lib/puppet/reports
masterlog = /var/log/puppet/puppetmaster.log
server_datadir = /var/lib/puppet/server_data
config = /etc/puppet/puppet.conf
pidfile = /var/run/puppet/master.pid
manifestdir = /etc/puppet/manifests
masterhttplog = /var/log/puppet/masterhttp.log
bucketdir = /var/lib/puppet/bucket
fileserverconfig = /etc/puppet/fileserver.conf
manifest = /etc/puppet/manifests/site.pp
templatedir = /var/lib/puppet/templates
tagmap = /etc/puppet/tagmail.conf
archive_file_server = puppet
rrddir = /var/lib/puppet/rrd
rrdinterval = 1800
1. Modify the master configuration file puppet. conf to insert the master field.
Vim/etc/puppet. conf
[Master]
Certname = rhel6u3-102.rsyslog.org \ set puppet authentication server host name
2. Create the node global configuration file site. pp. The file exists before the service can be started.
# touch /etc/puppet/manifests/site.pp
3. Start the puppetmaster service.
# /etc/rc.d/init.d/puppetmaster start
When testing or debugging for the first time, consider the following methods:
#puppet master --verbose --no-daemonize --debug
4. Configure the agent node rhel6u3-207.rsyslog.org) 1. Configure the first agent node and add the Host Name of the master to the main label.
vim /etc/puppet/puppet.conf
[main]
server=rhel6u3-102.rsyslog.org
2. Start the agent service
# /etc/rc.d/init.d/puppet start
When testing or debugging for the first time, consider the following methods:
# puppet agent --verbose –no-daemonize
5. Configure puppet master to register new nodes found
# Puppet cert -- list \ view nodes awaiting registration
# Puppet cert -- sign rhel6u3-207.rsyslog.org \ register a specified Node
# Puppet cert -- sign all \ register all nodes awaiting registration
6. Create a puppet configuration on the puppet master. 1. Create the first puppet configuration. 1) define the global configuration site. pp file and create the import directory.
# vim /etc/puppet/manifests/site.pp
$puppetserver = 'rhel6u3-102.rsyslog.org'
import 'nodes/*'
#mkdir /etc/puppet/manifests/nodes -p
2) Configure node nodes. pp
# vim /etc/puppet/manifests/nodes/nodes.pp
node 'rhel6u3-207.rsyslog.org'{
include myfile
package { 'vim-enhanced': ensure => present }
}
#node /^rhel6u3-\d+\.rsyslog.org'{
# include myfile
#}
2. Create the first puppet module. 1) create a module search path.
vim /etc/puppet/puppet.conf
[main]
modulepath=/etc/puppet/modules:/var/lib/puppet/modules:/usr/local/lib/puppet/modules
2) create a module directory structure
# Mkdir/etc/puppet/modules-p
# Mkdir-vp/etc/puppet/modules/myfile/{files, templates, manifests}
The manifests directory stores the module configuration files, the files directory stores the files contained in the module, and the templates directory.
Template in the module
3) Create the module core configuration file init. pp
vim /etc/puppet/modules/myfile/manifests/init.pp
class myfile {
package{ setup:
ensure => present,
}
file{ "/etc/myfile":
owner => "root",
group => "root",
mode => 644,
source => "puppet://$puppetserver/modules/myfile/files/etc/myfile",
require => Package["setup"],
}
}
The configuration is basically complete. The implementation result is as follows: 1. check whether the setup package is installed. If not installed, install it. 2. download the myfile file on "Puppet Master" and place it in the/etc directory. 4) create a synchronized test file.
# mkdir /etc/puppet/modules/myfile/files/etc -p
#echo "Hello Puppet" >/etc/puppet/modules/myfile/files/etc/myfile
5) Client Test
[root@rhel6u3-207 puppet]# cat /etc/myfile
Hello Puppet
** The client is started in the following way, and then we run and monitor it in the foreground mode. We use the puppet parameter-noop in, which means we only test, it is not true to run and modify the files on the node. The -- onetime parameter means to run only once and then exit.
#puppet agent --server=rhel6u3-102.rsyslog.org --no-daemonize --verbose
--noop --onetime
# puppet agent --server=rhel6u3-102.rsyslog.org --no-daemonize --verbose --noop --onetime
info: Caching catalog for rhel6u3-207.rsyslog.org
info: Applying configuration version '1366705990'
notice: Finished catalog run in 0.20 seconds
6) The default client synchronization time is 30 minutes, which can be set to 5 seconds.
Add the following fields to vim/etc/puppet. conf:
[Agent]
Runinterval = 5
Test method: Server Side
# date >>/etc/puppet/modules/myfile/files/etc/myfile
Client
Cat/etc/myfile
Hello Puppet
Tuesday, April 23, 2013 16:52:58 CST
All types of resources supported by puppet and their properties prepare rpm-ivh EPEL's YUM Source: # rpm-ivh http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
This article is from the blog of "the Linux open source technology blog", please be sure to keep this source http://dreamfire.blog.51cto.com/418026/1184796