Apache through puppet

[root@server ~]# puppet module list
/etc/puppet/modules (no modules installed)
/usr/share/puppet/modules (no modules installed)
——————————————————————————–
[root@server ~]# puppet module install puppetlabs-apache
Notice: Preparing to install into /etc/puppet/modules …
Notice: Downloading from https://forgeapi.puppetlabs.com
Notice: Installing — do not interrupt …
/etc/puppet/modules
└─┬ puppetlabs-apache (v1.10.0)
├── puppetlabs-concat (v2.1.0)
└── puppetlabs-stdlib (v4.12.0)
——————————————————————————–
[root@server ~]# puppet module list
/etc/puppet/modules
├── puppetlabs-apache (v1.10.0)
├── puppetlabs-concat (v2.1.0)
└── puppetlabs-stdlib (v4.12.0)
——————————————————————————–
[root@server ~]# ls -l /etc/puppet/modules/
total 12
drwxr-xr-x. 8 root root 4096 May 20 02:41 apache
drwxr-xr-x. 6 root root 4096 Jan 27 03:26 concat
drwxr-xr-x. 6 root root 4096 May 3 23:59 stdlib
——————————————————————————–
[root@server ~]# ls -l /etc/puppet/modules/apache/
total 280
-r–r–r–. 1 root root 31524 May 20 02:29 CHANGELOG.md
-r–r–r–. 1 root root 21882 May 20 02:41 checksums.json
-r–r–r–. 1 root root 8001 May 20 02:29 CONTRIBUTING.md
drwxr-xr-x. 2 root root 4096 Jun 12 12:00 examples
drwxr-xr-x. 2 root root 4096 Jun 12 12:00 files
-r–r–r–. 1 root root 1490 May 20 02:29 Gemfile
drwxr-xr-x. 4 root root 4096 Jun 12 12:00 lib
-r–r–r–. 1 root root 11358 May 20 02:29 LICENSE
drwxr-xr-x. 9 root root 4096 Jun 12 12:00 manifests
-r–r–r–. 1 root root 1701 May 20 02:41 metadata.json
-r–r–r–. 1 root root 643 May 20 02:29 NOTICE
-r–r–r–. 1 root root 1519 May 20 02:29 Rakefile
-r–r–r–. 1 root root 165504 May 20 02:29 README.md
drwxr-xr-x. 6 root root 4096 Jun 12 12:00 spec
drwxr-xr-x. 6 root root 4096 May 20 02:41 templates
——————————————————————————–
[root@server ~]# ls -l /etc/puppet/modules/apache/manifests/
total 180
-r–r–r–. 1 root root 1694 May 20 02:29 balancermember.pp
-r–r–r–. 1 root root 2776 May 20 02:29 balancer.pp
drwxr-xr-x. 2 root root 4096 Jun 12 12:00 confd
-r–r–r–. 1 root root 1992 May 20 02:29 custom_config.pp
-r–r–r–. 1 root root 283 May 20 02:29 default_confd_files.pp
drwxr-xr-x. 2 root root 4096 Jun 12 12:00 default_mods
-r–r–r–. 1 root root 5456 May 20 02:29 default_mods.pp
-r–r–r–. 1 root root 353 May 20 02:29 dev.pp
drwxr-xr-x. 2 root root 4096 Jun 12 12:00 fastcgi
-r–r–r–. 1 root root 13143 May 20 02:29 init.pp
-r–r–r–. 1 root root 231 May 20 02:29 listen.pp
drwxr-xr-x. 2 root root 4096 Jun 12 12:00 mod
-r–r–r–. 1 root root 5142 May 20 02:29 mod.pp
-r–r–r–. 1 root root 3774 May 20 02:29 mpm.pp
-r–r–r–. 1 root root 237 May 20 02:29 namevirtualhost.pp
-r–r–r–. 1 root root 1849 May 20 02:29 package.pp
-r–r–r–. 1 root root 23203 May 20 02:29 params.pp
drwxr-xr-x. 2 root root 4096 Jun 12 12:00 peruser
-r–r–r–. 1 root root 292 May 20 02:29 php.pp
-r–r–r–. 1 root root 282 May 20 02:29 proxy.pp
-r–r–r–. 1 root root 313 May 20 02:29 python.pp
drwxr-xr-x. 2 root root 4096 Jun 12 12:00 security
-r–r–r–. 1 root root 1173 May 20 02:29 service.pp
-r–r–r–. 1 root root 345 May 20 02:29 ssl.pp
-r–r–r–. 1 root root 1299 May 20 02:29 version.pp
drwxr-xr-x. 2 root root 4096 Jun 12 12:00 vhost
-r–r–r–. 1 root root 33691 May 20 02:29 vhost.pp
——————————————————————————–
[root@server ~]# cat /etc/puppet/manifests/site.pp
node default { }
node ‘client.puppet.com’ {
class { ‘apache’: # use the “apache” module
default_vhost => false, # don’t use the default vhost
default_mods => false, # don’t load default mods
mpm_module => ‘prefork’, # use the “prefork” mpm_module
}
include apache::mod::php # include mod php
apache::vhost { ‘example.com’: # create a vhost called “example.com”
port => ’80’, # use port 80
docroot => ‘/var/www/html’, # set the docroot to the /var/www/html
}
}
——————————————————————————–
[root@server ~]# puppet apply /etc/puppet/manifests/site.pp –noop
Notice: Compiled catalog for server.puppet.com in environment production in 0.05 seconds
Notice: Finished catalog run in 0.12 seconds
——————————————————————————–
[root@client ~]# cat /var/lib/puppet/classes.txt
settings
——————————————————————————–
[root@client ~]# puppet agent -t
Info: Computing checksum on file /etc/httpd/conf/httpd.conf
Info: /Stage[main]/Apache/File[/etc/httpd/conf/httpd.conf]: Filebucketed /etc/httpd/conf/httpd.conf to puppet with sum f6351c6d8c8dfc5899820d8c46d74651
Notice: /Stage[main]/Apache/File[/etc/httpd/conf/httpd.conf]/content: content changed ‘{md5}f6351c6d8c8dfc5899820d8c46d74651’ to ‘{md5}8802ca1e79835714dd63ca92db9f47d2’
Info: /Stage[main]/Apache/File[/etc/httpd/conf/httpd.conf]: Scheduling refresh of Class[Apache::Service]
Info: Class[Apache::Service]: Scheduling refresh of Service[httpd]
Notice: /Stage[main]/Apache::Service/Service[httpd]/ensure: ensure changed ‘stopped’ to ‘running’
Info: /Stage[main]/Apache::Service/Service[httpd]: Unscheduling refresh on Service[httpd]
Notice: Finished catalog run in 34.80 seconds
——————————————————————————–
[root@client ~]# cat /var/lib/puppet/classes.txt
settings
client.puppet.com
apache::version
apache::params
apache
apache::service
apache::default_mods
apache::default_confd_files
apache::mod::prefork
apache::mod::php
apache::mod::mime
apache::mod::dir
——————————————————————————–
[root@client ~]# cat /etc/httpd/conf/httpd.conf
# Security
ServerTokens OS
ServerSignature On
TraceEnable On

ServerName “client.puppet.com”
ServerRoot “/etc/httpd”
PidFile run/httpd.pid
Timeout 120
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
LimitRequestFieldSize 8190
User apache
Group apache

AccessFileName .htaccess
<FilesMatch “^\.ht”>
Order allow,deny
Deny from all
Satisfy all
</FilesMatch>

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
DefaultType none
HostnameLookups Off
ErrorLog “/var/log/httpd/error_log”
LogLevel warn
EnableSendfile On

#Listen 80
Include “/etc/httpd/conf.d/*.load”
Include “/etc/httpd/conf/ports.conf”

LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”” combined
LogFormat “%h %l %u %t \”%r\” %>s %b” common
LogFormat “%{Referer}i -> %U” referer
LogFormat “%{User-agent}i” agent
LogFormat “%{X-Forwarded-For}i %l %u %t \”%r\” %s %b \”%{Referer}i\” \”%{User-agent}i\”” forwarded

Include “/etc/httpd/conf.d/*.conf”
——————————————————————————–
[root@client ~]# service httpd status
httpd (pid 5937) is running…
——————————————————————————–
[root@client ~]# netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:49101 0.0.0.0:* LISTEN 1480/rpc.statd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1421/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1667/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1521/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1754/master
tcp 0 0 :::111 :::* LISTEN 1421/rpcbind
tcp 0 0 :::80 :::* LISTEN 5937/httpd
tcp 0 0 :::22 :::* LISTEN 1667/sshd
tcp 0 0 ::1:631 :::* LISTEN 1521/cupsd
tcp 0 0 ::1:25 :::* LISTEN 1754/master
tcp 0 0 :::40059 :::* LISTEN 1480/rpc.statd

catalog

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s