Puppet Enterprise Architecture deployment
I have been preparing for Puppet. I have read the Puppet document these two days and simulated the deployment scheme of Puppet in the production environment:
Test Machine:
Server: 192.168.3.68
Clinet: 192.168.3.67
Command rules:
Application _ IDC _ location _ IP address _ server system _ Domain Name
192.168.3.67 ppttest_wangsu_bj_192.168.3.67.CentOS.yypuppet.com
192.168.3.68 pptserver_wangsu_bj_192.168.3.68.centos.yypuppet.com
*****
This article focuses on deployment of the puppet architecture. The installation process is not the focus of this Article. Please install it on your own.
*****
Main configuration file:
Root @ pts/2 # cat/etc/puppet. conf
[Main]
Logdir =/var/log/puppet
Rundir =/var/run/puppet
Ssldir = $ vardir/ssl
[Agent]
Classfile = $ vardir/classes.txt
Localconfig = $ vardir/localconfig
Server = pptserver_wangsu_bj_192.168.3.68.centos.yypuppet.com
[Master]
Environments = yydev, yytest, yyprd
[Yydev]
Modulepath = $ confdir/multi-environment/yydev/environment/modules: $ confdir/multi-environment/yydev/application/modules
Manifest = $ confdir/multi-environment/yydev/manifests/site. pp
Fileserverconfig =/etc/puppet/fileserver. conf. yydev
[Yytest]
Modulepath = $ confdir/multi-environment/yytest/environment/modules: $ confdir/multi-environment/yytest/application/modules
Manifest = $ confdir/multi-environment/yytest/manifests/site. pp
Fileserverconfig =/etc/puppet/fileserver. conf. yytest
[Yyprd]
Modulepath = $ confdir/multi-environment/yyprd/environment/modules: $ confdir/multi-environment/yyprd/application/modules
Manifest = $ confdir/multi-environment/yyprd/manifests/site. pp
Fileserverconfig =/etc/puppet/fileserver. conf. yyprd
Why are there two directories, environment and application, in each environment? The environment directory stores the basic environment modules, such as puppet and yum;
The application directory contains application environment modules, such as apache and mysql. Of course, you can also put it in the same directory. If there are many applications, you can split the application. Everything is to facilitate management.
Implementation process:
1: Create a multi-environment directory:
Cd/etc/puppet
Mkdir-p multi-environment/yydev/environment/modules; mkdir-p multi-environment/yydev/application/modules
Mkdir-p multi-environment/yytest/environment/modules; mkdir-p multi-environment/yytest/application/modules
Mkdir-p multi-environment/yyprd/environment/modules; mkdir-p multi-environment/yyprd/application/modules
2: Create a multi-Environment File Server:
Cp/etc/puppet/fileserver. conf {,. yydev}; cp/etc/puppet/fileserver. conf {,. yytest}; cp/etc/puppet/fileserver. conf {,. yyprd}
3: copy existing modules to three environments:
Cp/etc/puppet/modules/ssh/etc/puppet/multi-environment/yydev/environment/modules
Cp/etc/puppet/modules/httpd/etc/puppet/multi-environment/yydev/application/modules
Cp/etc/puppet/modules/ssh/etc/puppet/multi-environment/yytest/environment/modules
Cp/etc/puppet/modules/httpd/etc/puppet/multi-environment/yytest/application/modules
Cp/etc/puppet/modules/ssh/etc/puppet/multi-environment/yyprd/environment/modules
Cp/etc/puppet/modules/httpd/etc/puppet/multi-environment/yyprd/application/modules
4: organizational structure:
Cd/etc/puppet/multi-environment
Tree
── Yydev
│ ── Application
│ ── Modules
│ ── Httpd
│ ── Files
│ ── 1.txt
│ ── Manifests
│ ── Init. pp
│ ── Templates
│ ── Environment
│ ── Modules
│ ── Ssh
│ ── Files
│ ── Sshd_config
│ ── Manifests
│ ── Config. pp
│ ── Init. pp
│ ── Install. pp
│ ── Params. pp
│ ── Service. pp
│ ── Templates
│ ── Test
│ ── Files
│ ── Manifests
│ ── Init. pp
│ ── Templates
│ ── Test. erb
│ ── Manifests
│ ── Nodes
│ ── Front_resin.pp
│ ── Site. pp
── Yyprd
│ ── Application
│ ── Modules
│ ── Environment
│ ── Modules
── Yytest
── Application
│ ── Modules
── Environment
── Modules
Module Learning (ssh ):
Ssh/
── Files
│ ── Sshd_config
── Manifests
│ ── Config. pp
│ ── Init. pp
│ ── Install. pp
│ ── Service. pp
└ ── Templates
Root @ pts/2 # cat init. pp config. pp install. pp service. pp
Class ssh {
Include ssh: install, ssh: service, ssh: config
}
Class ssh: config {
File {"/tmp/sshd_config ":
Ensure => present,
Owner => 'root ',
Group => 'root ',
Mode = & gt; 0440,
Source => "puppet: // modules/ssh/sshd_config ",
Require => Class ["ssh: install"],
Using Y => Class ["ssh: service"],
}
}
Class ssh: install {
Package {"openssh ":
Ensure => present,
}
}
Class ssh: service {
Service {"sshd ":
Ensure => running,
Hasstatus => true,
Hasrestart => true,
Enable => true,
Require => Class ["ssh: config"],
}
}
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: