Introduction to Puppet: 1. installation and configuration, and puppet Configuration Management
Puppet is a configuration management tool. This article describes how to install and set Puppet.
What is Puppet?
Puppet is a configuration management tool produced by puppetlabs. The annual DORA DevOps report is led by puppetlabs. puppet is also an excellent management tool and can be circled. By setting descriptive information with good readability, you can complete many complex functions. For example, you can ensure that the software wget is installed and the user admin is created without having to deal with too much details, the rest are delivered to the Puppet composed of the Agent/Master.
package { 'wget': ensure => installed,}user { 'admin':ensure => present,}
Agent/Master VS Stand-alone
Puppet can be used as the Agent/Master mode or Stand-alone mode. The latter is only used as a standalone version tool and can be selected as needed.
Installation preparation
The installation and configuration information in this article is as follows:
IP |
Hostname |
OS |
Puppet Software |
192.169.31.131 |
Host131 |
CentOS7.4 |
Puppet-server 5.4 |
192.169.31.20. |
Hostnames |
CentOS7.4 |
Puppet-agent 5.4 |
Install Master
To install Puppet Master, follow these steps:
- Step 1: rpm-Uvh
Https://yum.puppet.com/puppet5/puppet5-release-el-7.noarch.rpm
- Step 2: yum install puppetserver
Confirm version
[root@host131 ~]# puppet --version5.4.0[root@host131 ~]#
Install Agent
To install the Puppet Agent, follow these steps:
- Step 1: rpm-Uvh
Https://yum.puppet.com/puppet5/puppet5-release-el-7.noarch.rpm
- Step 2: yum install puppet-agent
Confirm version
[root@host133 ~]# puppet --version5.4.0[root@host133 ~]#
Set initialization to start Puppet master
On the master node host131, run the following command to start the master.-debug indicates the output debugging information.
[root@host131 ~]# puppet master --no-daemonize --debugDebug: Applying settings catalog for sections main, master, ssl, metricsDebug: Evicting cache entry for environment 'production'Debug: Caching environment 'production' (ttl = 0 sec)...
Start Agent
Try to connect to the host133 on the node where the agent is located. Because it is not set by default, you can pass in settings through server = host131.
[root@host133 ~]# puppet agent --server=host131 --test --debugDebug: Applying settings catalog for sections main, agent, sslDebug: Caching environment 'production' (ttl = 0 sec)Debug: Evicting cache entry for environment 'production'Debug: Caching environment 'production' (ttl = 0 sec)...Debug: Dynamically-bound port lookup failed; falling back to ca_port settingDebug: Creating new connection for https://host131:8140Exiting; no certificate found and waitforcert is disabled[root@host133 ~]#
The certificate settings are incorrect as prompted, so you need to set the server-side certificate information.
Default Certificate Information
List the current certificate information. Two certificates are found, including host131 and hostnames on the current machine. If + is not included before hostnames, the certificate is not approved.
[root@host131 ~]# puppet cert list -all "host133" (SHA256) 52:2A:AE:C0:58:47:B1:C3:8E:BC:80:F5:51:71:6C:46:77:58:00:4C:96:61:6D:FA:4E:AD:59:4B:F6:71:78:4E+ "host131" (SHA256) 0E:2E:2B:22:61:E8:F1:59:3A:E4:92:F9:99:2E:3F:D4:7F:D6:E6:83:21:E0:96:4B:1F:4E:7A:A3:D4:EE:FA:78[root@host131 ~]#
The test information sent from the client host133 fails because the host133 certificate has not passed the review. Use the command to review and confirm the certificate.
[root@host131 ~]# puppet cert sign host133Signing Certificate Request for: "host133" (SHA256) 52:2A:AE:C0:58:47:B1:C3:8E:BC:80:F5:51:71:6C:46:77:58:00:4C:96:61:6D:FA:4E:AD:59:4B:F6:71:78:4ENotice: Signed certificate request for host133Notice: Removing file Puppet::SSL::CertificateRequest host133 at '/etc/puppetlabs/puppet/ssl/ca/requests/host133.pem'[root@host131 ~]# [root@host131 ~]# puppet cert list -all+ "host131" (SHA256) 0E:2E:2B:22:61:E8:F1:59:3A:E4:92:F9:99:2E:3F:D4:7F:D6:E6:83:21:E0:96:4B:1F:4E:7A:A3:D4:EE:FA:78+ "host133" (SHA256) 68:4B:45:DD:99:C7:F7:ED:25:BB:DC:BD:18:3A:81:8C:EF:9F:1D:3E:FB:1E:2D:73:B3:77:31:DE:46:E4:E1:E5[root@host131 ~]#
Re-connect to the Agent
When the Agent is connected again, it is found that the Agent can communicate with the Master normally.
[root@host133 ~]# puppet agent --server=host131 --testInfo: Caching certificate for host133Info: Caching certificate_revocation_list for caInfo: Caching certificate for host133Info: Using configured environment 'production'Info: Retrieving pluginfactsInfo: Retrieving pluginInfo: Retrieving localesInfo: Caching catalog for host133Info: Applying configuration version '1519038659'Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yamlNotice: Applied catalog in 0.01 seconds[root@host133 ~]#
Copyright Disclaimer: This article is an original article by the blogger. You are welcome to reprint it without permission from the blogger, but please indicate the source. Http://blog.csdn.net/liumiaocn/article/details/79338066