Deployment and file transfer test for cloud management tool puppet

Source: Internet
Author: User
Tags rsyslog

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 "/>

 
 
  1. [root@rhel6u3-102 puppet]# uname -r 

  2. 2.6.32-279.el6.x86_64 

  3. [root@rhel6u3-102 puppet]# cat /etc/redhat-release  

  4. 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.
 
 
  1. yum install ruby ruby-libs ruby-shadow compat-readline5 libselinux-ruby augeas-libs 

  2. 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)
 
 
  1. yum install ruby ruby-libs ruby-shadow compat-readline5 libselinux-ruby augeas-libs 

  2. 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:
 
 
  1. sed -e '/#/d' -e '/^$/d' puppet.conf 

You can use the following command to generate a more detailed configuration file.
 
 
  1. #puppetmasterd --genconfig >puppet.conf.out  


 
 
  1. [root@rhel6u3-102 puppet]# sed -e '/#/d' -e '/^$/d' puppet.conf.out  

  2. [master] 

  3. ssldir = /var/lib/puppet/ssl 

  4. factdest = /var/lib/puppet/facts/ 

  5. privatekeydir = /var/lib/puppet/ssl/private_keys 

  6. rundir = /var/run/puppet 

  7. hostcsr = /var/lib/puppet/ssl/csr_rhel6u3-102.rsyslog.org.pem 

  8. hostpubkey = /var/lib/puppet/ssl/public_keys/rhel6u3-102.rsyslog.org.pem 

  9. plugindest = /var/lib/puppet/lib 

  10. inventory_terminus = yaml

  11. publickeydir = /var/lib/puppet/ssl/public_keys 

  12. factsource = puppet://puppet/facts/ 

  13. privatedir = /var/lib/puppet/ssl/private 

  14. logdir = /var/log/puppet 

  15. libdir = /var/lib/puppet/lib 

  16. statedir = /var/lib/puppet/state 

  17. hostcert = /var/lib/puppet/ssl/certs/rhel6u3-102.rsyslog.org.pem 

  18. localcacert = /var/lib/puppet/ssl/certs/ca.pem 

  19. pluginsource = puppet://puppet/plugins 

  20. certdir = /var/lib/puppet/ssl/certs 

  21. factpath = /var/lib/puppet/lib/facter:/var/lib/puppet/facts 

  22. httplog = /var/log/puppet/http.log 

  23. requestdir = /var/lib/puppet/ssl/certificate_requests 

  24. passfile = /var/lib/puppet/ssl/private/password 

  25. hostprivkey = /var/lib/puppet/ssl/private_keys/rhel6u3-102.rsyslog.org.pem 

  26. hostcrl = /var/lib/puppet/ssl/crl.pem 

  27. authconfig = /etc/puppet/namespaceauth.conf 

  28. localconfig = /var/lib/puppet/state/localconfig 

  29. client_datadir = /var/lib/puppet/client_data 

  30. reportserver = puppet

  31. inventory_server = puppet

  32. ca_server = puppet

  33. lastrunreport = /var/lib/puppet/state/last_run_report.yaml 

  34. node_name_value = rhel6u3-102.rsyslog.org 

  35. statefile = /var/lib/puppet/state/state.yaml 

  36. clientbucketdir = /var/lib/puppet/clientbucket 

  37. classfile = /var/lib/puppet/state/classes.txt 

  38. report_server = puppet

  39. inventory_port = 8140

  40. ca_port = 8140

  41. puppetdlockfile = /var/lib/puppet/state/puppetdlock 

  42. splaylimit = 1800

  43. clientyamldir = /var/lib/puppet/client_yaml 

  44. puppetdlog = /var/log/puppet/puppetd.log 

  45. report_port = 8140

  46. lastrunfile = /var/lib/puppet/state/last_run_summary.yaml 

  47. graphdir = /var/lib/puppet/state/graphs 

  48. capub = /var/lib/puppet/ssl/ca/ca_pub.pem 

  49. csrdir = /var/lib/puppet/ssl/ca/requests 

  50. autosign = /etc/puppet/autosign.conf 

  51. cert_inventory = /var/lib/puppet/ssl/ca/inventory.txt 

  52. cacert = /var/lib/puppet/ssl/ca/ca_crt.pem 

  53. cacrl = /var/lib/puppet/ssl/ca/ca_crl.pem 

  54. signeddir = /var/lib/puppet/ssl/ca/signed 

  55. serial = /var/lib/puppet/ssl/ca/serial 

  56. ca_name = Puppet CA: rhel6u3-102.rsyslog.org 

  57. cakey = /var/lib/puppet/ssl/ca/ca_key.pem 

  58. caprivatedir = /var/lib/puppet/ssl/ca/private 

  59. capass = /var/lib/puppet/ssl/ca/private/ca.pass 

  60. cadir = /var/lib/puppet/ssl/ca 

  61. railslog = /var/log/puppet/rails.log 

  62. dblocation = /var/lib/puppet/state/clientconfigs.sqlite3 

  63. rest_authconfig = /etc/puppet/auth.conf 

  64. modulepath = /etc/puppet/modules:/usr/share/puppet/modules 

  65. yamldir = /var/lib/puppet/yaml 

  66. reportdir = /var/lib/puppet/reports 

  67. masterlog = /var/log/puppet/puppetmaster.log 

  68. server_datadir = /var/lib/puppet/server_data 

  69. config = /etc/puppet/puppet.conf 

  70. pidfile = /var/run/puppet/master.pid 

  71. manifestdir = /etc/puppet/manifests 

  72. masterhttplog = /var/log/puppet/masterhttp.log 

  73. bucketdir = /var/lib/puppet/bucket 

  74. fileserverconfig = /etc/puppet/fileserver.conf 

  75. manifest = /etc/puppet/manifests/site.pp 

  76. templatedir = /var/lib/puppet/templates 

  77. tagmap = /etc/puppet/tagmail.conf 

  78. archive_file_server = puppet

  79. rrddir = /var/lib/puppet/rrd 

  80. rrdinterval = 1800

1. Modify the master configuration file puppet. conf to insert the master field.
 
 
  1. Vim/etc/puppet. conf

  2. [Master]

  3. 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.
 
 
  1. # touch /etc/puppet/manifests/site.pp 

3. Start the puppetmaster service.
 
 
  1. # /etc/rc.d/init.d/puppetmaster start 

When testing or debugging for the first time, consider the following methods:
 
 
  1. #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.
 
 
  1. vim /etc/puppet/puppet.conf  

  2. [main] 

  3. server=rhel6u3-102.rsyslog.org 

2. Start the agent service
 
 
  1. # /etc/rc.d/init.d/puppet start 

When testing or debugging for the first time, consider the following methods:
 
 
  1. # puppet agent --verbose –no-daemonize 

5. Configure puppet master to register new nodes found
 
 
  1. # Puppet cert -- list \ view nodes awaiting registration

  2. # Puppet cert -- sign rhel6u3-207.rsyslog.org \ register a specified Node

  3. # 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.
 
 
  1. # vim /etc/puppet/manifests/site.pp  

  2. $puppetserver = 'rhel6u3-102.rsyslog.org'

  3. import 'nodes/*' 

  4. #mkdir /etc/puppet/manifests/nodes -p 

2) Configure node nodes. pp
 
 
  1. # vim /etc/puppet/manifests/nodes/nodes.pp 

  2. node 'rhel6u3-207.rsyslog.org'{ 

  3.         include myfile 

  4.         package { 'vim-enhanced': ensure => present } 

  5. #node /^rhel6u3-\d+\.rsyslog.org'{ 

  6. #       include myfile 

  7. #} 

2. Create the first puppet module. 1) create a module search path.
 
 
  1. vim /etc/puppet/puppet.conf  

  2. [main] 

  3. modulepath=/etc/puppet/modules:/var/lib/puppet/modules:/usr/local/lib/puppet/modules 

2) create a module directory structure
 
 
  1. # Mkdir/etc/puppet/modules-p

  2. # Mkdir-vp/etc/puppet/modules/myfile/{files, templates, manifests}

  3. The manifests directory stores the module configuration files, the files directory stores the files contained in the module, and the templates directory.

  4. Template in the module

3) Create the module core configuration file init. pp
 
 
  1. vim /etc/puppet/modules/myfile/manifests/init.pp 

  2. class myfile { 

  3.         package{ setup: 

  4. ensure => present, 

  5.         } 

  6.         file{ "/etc/myfile": 

  7. owner => "root", 

  8. group => "root", 

  9. mode => 644, 

  10. source => "puppet://$puppetserver/modules/myfile/files/etc/myfile", 

  11. require => Package["setup"], 

  12.         } 

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.
 
 
  1. # mkdir /etc/puppet/modules/myfile/files/etc -p 

  2. #echo "Hello Puppet" >/etc/puppet/modules/myfile/files/etc/myfile 

5) Client Test
 
 
  1. [root@rhel6u3-207 puppet]# cat /etc/myfile  

  2. 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.
 
 
  1. #puppet agent --server=rhel6u3-102.rsyslog.org  --no-daemonize --verbose 

  2. --noop --onetime 

  3. # puppet agent --server=rhel6u3-102.rsyslog.org --no-daemonize --verbose --noop --onetime 

  4. info: Caching catalog for rhel6u3-207.rsyslog.org 

  5. info: Applying configuration version '1366705990' 

  6. notice: Finished catalog run in 0.20 seconds 

6) The default client synchronization time is 30 minutes, which can be set to 5 seconds.
 
 
  1. Add the following fields to vim/etc/puppet. conf:

  2. [Agent]

  3. Runinterval = 5

Test method: Server Side
 
 
  1. # date >>/etc/puppet/modules/myfile/files/etc/myfile  

Client
 
 
  1. Cat/etc/myfile

  2. Hello Puppet

  3. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.