Puppet tutorial 1: Install puppet to configure the epel software source

Source: Internet
Author: User
ArticleDirectory
    • Install master
    • Install agent
    • Server SSL Authentication
    • Simple Test

The most convenient way to install puppet is to use the epel software source. Therefore, before installing the master and agent, see configure epel software source to add an epel software source.

 

Install master

Master environment: virtualbox virtual machine, centos 6.2 operating system, machine name is centos-server.s3lighting.com, IP address is 192.168.12.215.

 

1. Use Yum to install the puppet-master package:

 
[Root @ centos-server ~] $ YumInstallPuppet-Server

After the installation is complete, use chkconfig to find two more services: puppetmaster and puppet.

 

2. Configure the iptables firewall.The original firewall policy is as follows:

[Root @ centos-server ~] $ Iptables-l-N -- line- Numberschain input (Policy accept) num target prot opt source destination 1 Accept all -- 0.0 . 0.0 / 0              0.0 . 0.0 / 0  State related, established  2 Accept ICMP -- 0.0 . 0.0 / 0              0.0 . 0.0 /0             3 Accept all -- 0.0 . 0.0 / 0              0.0 . 0.0 / 0             4 Accept TCP -- 0.0 . 0.0 / 0              0.0 . 0.0 /0 State New tcp dpt: 22   5 Reject all -- 0.0 . 0.0 / 0              0.0 . 0.0 / 0 Reject-with ICMP-host- Prohibited chain forward (Policy accept) num target prot opt source destination  1 Reject all -- 0.0 .0.0 / 0              0.0 . 0.0 / 0 Reject-with ICMP-host- Prohibited chain output (Policy accept) num target prot opt source destination 

Follow these steps to enable port 8140 of puppet:

[Root @ centos-server ~] $ Iptables-I input5-P tcp-m tcp -- dport8140-M state -- state new-J accept [root @ centos-Server ~] $ Service iptables saveiptables: Saving firewall rules/Etc/sysconfig/Iptables: [OK] [root @ centos-Server ~] $ Service iptables restartiptables: flushing firewall rules: [OK] iptables: Setting chains to policy accept: Filter [OK] iptables: unloading modules: [OK] iptables: Applying firewall rules: [OK]

 

3. Start the puppetmaster service:

 
[Root @ centos-server ~] $ Chkconfig puppetmaster on [root @ centos-Server ~] $ Service puppetmaster start

 

Install agent

Agent environment: virtualbox virtual machine, the operating system is centos 6.2, the machine name is centos-client.s3lighting.com, IP address is 192.168.12.54.

 

1. Use Yum to install the puppet package:

 
[Root @ centos-client ~] $ YumInstallPuppet

After the installation is complete, use chkconfig to find an additional service: puppet.

 

2. Configure puppet Server:

 
[Root @ centos-client etc] #Echo "Server = centos-server.s3lighting.com">/Etc/puppet. conf

 

3. Add the server address in/etc/hosts:

[Root @ centos-client etc] #Echo "192.168.12.215 centos-server centos-server.s3lighting.com">/Etc/hosts

 

Server SSL Authentication

Each agent must pass master authentication before obtaining configuration information from the master.

 

1. Send a request in the agent:

[Root @ centos-client etc] # puppet agent -- Test  Info : Creating a new SSL Key For Centos- Client. s3lighting. comwarning: Peer certificate won  '  T be verified in this SSL session Info : Caching Certificate For  Cawarning: Peer certificate won  '  T be verified in this SSL session Warning: Peer certificate won '  T be verified in this SSL session  Info : Creating a new SSL certificate request For Centos- Client.s3lighting.com  Info : Certificate request fingerprint (MD5 ): 92 : D8:57 : A1: 83 : ED: F0: 30 : 3C: 08 : 98 : 6e: 41 : E7: 1b: 03  Warning: Peer certificate won  '  T be verified in this SSL session Warning: Peer certificate won '  T be verified in this SSL session Warning: Peer certificate won ' T be verified in this SSL session Exiting; no certificate found and waitforcert is disabled

 

2. Master query received authentication requests:

 
[Root @ centos-server ~] $ Puppet Cert listcentos-Client.s3lighting.com (92: D8:57: A1:83: ED: F0:30: 3C:08:98: 6e:41: E7: 1b:03)

Use the sign command to authenticate the received request:

[Root @ centos-server ~] $ Puppet Cert sign centos-Client. s3lighting. comnotice: signed certificate requestForCentos-Client. s3lighting. comnotice: removingFilePuppet: SSL: certificaterequest centos-client.s3lighting.com'// Var/lib/puppet/SSL/CA/requests/centos-client.s3lighting.com.pem'

 

3. The agent sends the request again with the following command:

[Root @ centos-client Puppet] # puppet agent -- Testwarning: Peer certificate won  '  T be verified in this SSL session  Info : Caching CertificateFor Centos- Client.s3lighting.com  Info : Caching certificate_revocation_list For  CA  Info : Caching catalog For Centos- Client.s3lighting.com  Info : Applying configuration version '  1343033559  '  Info : Creating stateFile /Var/lib/puppet/State/ State. yamlnotice: Finished catalog run  In   0.01 Seconds

OK. The agent can successfully obtain the configuration information from the master.

 

Simple Test

1. Create the file/etc/puppet/manifests/site. PP on the master. The content is as follows:

File{'Testfile': Path=>'/Tmp/testfile', Ensure=>Present, Mode=>0640, Content=>"I'm a test file."}

 

2. Execute the configuration request on the agent:

[Root @ centos-client ~] # Puppet agent --TestInfo: Caching catalogForCentos-Client.s3lighting.comInfo: Applying configuration version'1343091079'Notice:/Stage [main]//File [testfile]/ensure: createdNotice: Finished catalog runIn 0.02Seconds

We can see that testfile is created.

 

Reference: http://docs.puppetlabs.com/guides/installation.html

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.