Http://puppet.wikidot.com/puppet1
You can also use puppet init. PP to use puppet. however, this cannot take advantage of puppet. the biggest advantage of puppet is the C/S mode configuration. all managed machines get their configuration files from the same puppet master server and download them back for execution. the following uses two servers to demonstrate how to configure a C/S Mode puppet management architecture. this architecture works with agents to manage thousands of machines.
Test Environment
- Hardware: two servers, both virtual servers and physical machines, with IP addresses 192.168.1.2 and 192.168.1.3. The following uses 1.2 and 1.3 to replace the two servers.
- Software: Debian system installation
- Network: two machines can access each other
Puppet Server Configuration
Set the system Host Name On Machine 1.2 and set the Host Name of the server to master.example.com.
echo 'master.example.com' > /etc/hostnamehostname -F /etc/hostname
Log out of the system and log on to the system again to make the host name take effect. This is very important because the SSL Certificate of puppet depends on the host name.
Install puppetmaster Software
apt-get install puppetmaster
The first code executed by puppet is in/etc/puppet/manifest/site. pp.
Therefore, this file must exist and other code must be called by code.
Now, create a simple site. PP file with the following content:
node default { file { "/tmp/temp1.txt": content => "hello,first puppet manifest"; } }
The code above performs an operation on the puppet Client Connected by default. A temp1.txt file is generated in the/tmpdirectory with the content hello, first puppet manifest.
Puppet client Configuration
Set the host name to client.example.com on machine 1.3.
echo 'client.example.com' >/etc/hostnamehostname -F /etc/hostname
Log out of the system, log on to the system again, and install puppet.
apt-get install puppet
After puppet is installed, run
puppetd --server master.example.com --test
The preceding command allows puppetd to read the puppet configuration file from master.example.com. for the first connection, both parties will verify the SSL certificate. This is a new client that has not been authenticated on the server. Therefore, certificates must be authenticated on the server. run the following command on both servers at 192.168.1.2 to authenticate the client certificate.
puppetca -s client.example.com
Then run the command again on the client 192.168.1.3.
puppetd --server master.example.com --test
You can see some debugging information from puppet and create the/tmp/temp1.txt file in the/tmp directory.
At this point, the most basic puppet environment has been built. For more complex and powerful features, you can play it yourself.