Puppet Learning--Basic installation and configuration

Source: Internet
Author: User

0. Installation Environment
Client IP Puppet_client.example.net (192.168.1.10)
Server-Side IP Puppet_server.example.net (192.168.1.11)
OS Version CentOS Release 6.6 x86_64
Puppet version 3.7.5

1. Pre-installed configuration

Some of the necessary preinstallation configurations are required on the server side and the client, so the following commands in this section need to be performed on both the client and the server side.

(1) Yum install ruby #安装ruby

(2) Modify/etc/hosts, write two lines:

192.168.1.10 puppet_client.example.net
192.168.1.11 puppet_server.example.net

(3) Rpm-ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm #安装puppet仓库

2. Install the service side

Log in to Puppet_server.example.net and execute the following command:

[Email protected]_server.example.net ~]# yum install puppet-server puppet–y #安装puppet服务端和客户端
[Email protected]_server.example.net ~]# Puppet Resource Package Puppet-server ensure=latest #更新puppet服务端

[[email protected]_client.example.net ~]# Mv/etc/puppet/puppet.conf/etc/puppet/puppet.conf_bak #备份原配置文件    
[[email  Protected]_client.example.net ~]# vim/etc/puppet/puppet.conf   # Re-write the file with the following contents:

/table>

[main]       &NBS P  
    logdir =/var/log/puppet            
    ru Ndir =/var/run/puppet           &NBSP
    ssldir = $vardir/ssl            
[agent]            
    classfile = $vardir /classes.txt           &NBSP
    localconfig = $vardir/localconfig   &NB Sp        
    server = puppet_server.example.net           &N Bsp
    certname = puppetmaster_cert.example.net            
[Master] & nbsp          
    certname = puppet_server.example.net

[Email protected]_server.example.net ~]# chkconfig puppetmaster on #设置puppetmaster服务开启启动
[[Email protected]_server.example.net ~]# service puppetmaster start #启动puppetmaster


3. Installing the Client

Log in to Puppet_client.example.net and execute the following command:

[Email protected]_client.example.net ~]# yum install puppet–y #安装puppet客户端
[Email protected]_client.example.net ~]# Puppet Resource Package puppet ensure=latest #更新puppet

[[email protected]_client.example.net ~]# Mv/etc/puppet/puppet.conf/etc/puppet/puppet.conf_bak #备份原配置文件    
[[email  Protected]_client.example.net ~]# vim/etc/puppet/puppet.conf   # Re-write the file with the following contents:

[main]       &NBS P  
    logdir =/var/log/puppet            
    ru Ndir =/var/run/puppet           &NBSP
    ssldir = $vardir/ssl            
[agent]            
    classfile = $vardir /classes.txt           &NBSP
    localconfig = $vardir/localconfig   &NB Sp        
    server = puppet_server.example.net           &N Bsp
    certname = puppetmaster_cert.example.net

[Email protected]_client.example.net ~]# chkconfig puppet on #设置puppet服务开启启动/etc/puppet/puppet.conf
[[Email protected]_client.example.net ~]# service puppet start #启动puppet

4. Client and server Authentication

The client initiates the authentication to the puppetmaster side through the debug mode boot node:

[Email protected]_client.example.net ~]# puppet agent–t

Info:caching Certificate for Puppet_client.example.net
Info:caching Certificate for Puppet_client.example.net
info:caching Catalog for Puppet_client.example.net
Info:applying configuration version ' 1430120791 '
notice:finished catalog run in 0.02 seconds

Service-Side Identification certification:

[[Email protected]_server.example.net ~]# puppet cert--list-all #查看所有证书, the certificate is not in front of the + number

[Email protected]_server.example.net ~]# puppet cert--sign-all #对所有证书进行认证

Or, only the specified certificate is certified:

[Email protected]_server.example.net ~]# puppet cert--sign "puppet_client.example.net" #对指定的证书进行认证

[[Email protected]_server.example.net ~]# puppet cert--list-all #再次查看所有证书, the certificate has a + number before it, indicating that it has been certified by

5. A simple example of client operation

Now give a simple example of how to use it.

If we need to install the lsof command on the client, we normally need to run the Yum Install lsof-y command, which is the command on Rhel and the CentOS system, and the Apt-get command on Debian, Ubuntu and other systems. If you need to install the lsof command more than the system, you need to write a script to determine the system version to install. However, in puppet, the above requirements can be achieved simply by the following means.

First, create a/etc/puppet/manifests/site.pp file on the puppet server with the following content:

[Email protected]_server.example.net ~]# vim/etc/puppet/manifests/site.pp

package{' lsof ':
ensure = installed,
}

Then, execute the puppet agent-t command on the client side:

[Email protected]_client.example.net ~]# puppet agent-t
info:caching Catalog for Puppet_client.example.net
Info:applying configuration version ' 1430127711 '
Notice:/stage[main]/main/package[lsof]/ensure:created
notice:finished catalog run in 6.90 seconds

The output has indicated that the LSOF package has been successfully installed. Take a look:

[Email protected]_client.example.net ~]# rpm-q lsof
Lsof-4.82-4.el6.x86_64

Description: The puppet agent-t command is to run the agent manually on the client. Puppet the client itself if the puppet service is started, Puppet is able to run the agent automatically after a period of time, the default time interval is 1800s. You can modify the time interval parameter, modify the/etc/puppet/puppet.conf file in the Client Agent node, modify the [agent] under: runinterval = 100, in seconds, and then restart Puppet:service puppet Restart

This article from "Fireworks Easy Cold" blog, reproduced please contact the author!

Puppet Learning--Basic installation and configuration

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.