Basic Learning for Puppet
1. view official download sources
Https://docs.puppet.com/guides/puppetlabs_package_repositories.html
2. Select the download source for the corresponding system
Because the local machine is CentOS 7.1, select the YUM Source
Https://yum.puppetlabs.com/
3. Install Puppet
# Wget https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
# Rpm-ivh puppetlabs-release-el-7.noarch.rpm
# Yum install puppet-y
# Puppet -- version
3.8.7
Iv. Puppet configuration file Introduction
Put the master configuration files of Puppet in the/etc/puppet directory. Versions 3.8.7 have the following files:
Auth. conf modules puppet. conf
Where:
Puppet. conf is the Master configuration file of the Master daemon. It defines the running environment of the Master and starts loading files. The daemon performs a pre-check based on the file before it starts.
Daemon.
Auth. conf is mainly used to define the Agent's permission to access the directory on the Master. Without permission control, the Agent can access all resources on the Master server.
5. Install the nginx package and start the nginx Service
To install the nginx package, run the puppet resource command to generate the template and edit it.
[Root @ master1 ~] # Puppet resource package nginx
Package {'nginx ':
Ensure => 'absent ',
}
[Root @ master1 ~] # Puppet resource service nginx
Service {'nginx ':
Ensure => 'stopped ',
Enable => 'false ',
}
Puppet resource package is the template for generating the installation package, and puppet resource service is the template for generating the service.
Finally, the configuration file of the nginx package is as follows:
Package {'nginx ':
Ensure => 'present ',
}
Service {'nginx ':
Ensure => 'running ',
}
Apply the configuration file locally
# Puppet apply nginx. pp
Notice: Compiled catalog for master1.localdomain in environment production in 0.56 seconds
Notice:/Stage [main]/Main/Package [nginx]/ensure: created
Notice:/Stage [main]/Main/Service [nginx]/ensure: ensure changed 'stopped 'to 'running'
Notice: Finished catalog run in 5.76 seconds
Check whether the nginx package is installed and whether the service is started.
[Root @ master1 ~] # Rpm-qa | grep nginx
Nginx-1.6.3-9.el7.x86_64
Nginx-filesystem-1.6.3-9.el7.noarch
[Root @ master1 ~] # Ps-ef | grep nginx
Root 3094 3070 0 00:00:00 pts/2 tailf/var/log/nginx/error. log
Root 3423 1 0? 00:00:00 nginx: master process/usr/sbin/nginx
Nginx 3424 3423 0? 00:00:00 nginx: worker process
Nginx 3425 3423 0? 00:00:00 nginx: worker process
Root 3432 1536 0 00:00:00 pts/0 grep -- color = auto nginx
Puppet Learning Series:
Puppet Learning 1: Installation and simple instance applications
Puppet 2: simple module configuration and application
Research on three Backup Recovery solutions for Puppet agent
Register your Puppet node in a safer way
Deep understanding of Puppet syntax and working mechanism through SSH Configuration
Puppet uses Nginx multiple ports for Load Balancing
C/S mode instance of Puppet in CentOS (5 and 6)
For more information about Puppet, click here.
Puppet: click here
This article permanently updates the link address: