Puppet Quick Start and puppet Quick Start
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 nginxpackage { 'nginx': ensure => 'absent',}[root@master1 ~]# puppet resource service nginxservice { '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 secondsNotice: /Stage[main]/Main/Package[nginx]/ensure: createdNotice: /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 nginxnginx-1.6.3-9.el7.x86_64nginx-filesystem-1.6.3-9.el7.noarch[root@master1 ~]# ps -ef |grep nginxroot 3094 3070 0 13:14 pts/2 00:00:00 tailf /var/log/nginx/error.logroot 3423 1 0 13:16 ? 00:00:00 nginx: master process /usr/sbin/nginxnginx 3424 3423 0 13:16 ? 00:00:00 nginx: worker processnginx 3425 3423 0 13:16 ? 00:00:00 nginx: worker processroot 3432 1536 0 13:18 pts/0 00:00:00 grep --color=auto nginx