Nginx through puppet

[root@puppetmaster ~]# cat /etc/puppet/modules/nginx/manifests/init.pp
# Class: nginx
#
# This module manages NGINX.
#
# Parameters:
#
# There are no default parameters for this class. All module parameters are managed
# via the nginx::params class
#
# Actions:
#
# Requires:
# puppetlabs-stdlib – https://github.com/puppetlabs/puppetlabs-stdlib
#
# Packaged NGINX
# – RHEL: EPEL or custom package
# – Debian/Ubuntu: Default Install or custom package
# – SuSE: Default Install or custom package
#
# stdlib
# – puppetlabs-stdlib module >= 0.1.6
# – plugin sync enabled to obtain the anchor type
#
# Sample Usage:
#
# The module works with sensible defaults:
#
# node default {
# include nginx
# }
class nginx (
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$confd_purge = $nginx::params::nx_confd_purge,
$configtest_enable = $nginx::params::nx_configtest_enable,
$service_restart = $nginx::params::nx_service_restrart
) inherits nginx::params {

warning(‘This module is no longer supported and we direct you to our upstream source, http://forge.puppetlabs.com/jfryman/nginx’)

include stdlib

class { ‘nginx::package’:
notify => Class[‘nginx::service’],
}

class { ‘nginx::config’:
worker_processes => $worker_processes,
worker_connections => $worker_connections,
proxy_set_header => $proxy_set_header,
confd_purge => $confd_purge,
require => Class[‘nginx::package’],
notify => Class[‘nginx::service’],
}

class { ‘nginx::service’:
configtest_enable => $configtest_enable,
service_restart => $service_restart,
}

# Allow the end user to establish relationships to the “main” class
# and preserve the relationship to the implementation classes through
# a transitive relationship to the composite class.
anchor{ ‘nginx::begin’:
before => Class[‘nginx::package’],
notify => Class[‘nginx::service’],
}
anchor { ‘nginx::end’:
require => Class[‘nginx::service’],
}
}


[root@puppetmaster ~]# puppet module install camptocamp-ssh
Notice: Preparing to install into /etc/puppet/modules …
Notice: Downloading from https://forgeapi.puppetlabs.com
Notice: Installing — do not interrupt …
/etc/puppet/modules
ā””ā”€ā”€ camptocamp-ssh (v1.1.0)
[root@puppetmaster ~]# ls -l /etc/puppet/modules/
apache/ augeasproviders_shellvar/ firewall/ nginx/ stdlib/
augeasproviders_core/ concat/ nfs/ ssh/ vsftpd/
[root@puppetmaster ~]# ls -l /etc/puppet/modules/ssh/
total 36
-r–r–r– 1 root root 4149 Mar 17 13:24 checksums.json
-r–r–r– 1 root root 2372 Mar 17 13:22 Gemfile
drwxr-xr-x 3 root root 4096 Mar 17 13:24 lib
drwxr-xr-x 3 root root 4096 Mar 17 13:24 manifests
-r–r–r– 1 root root 929 Mar 17 13:24 metadata.json
-r–r–r– 1 root root 771 Mar 17 13:22 Rakefile
-r–r–r– 1 root root 86 Mar 17 13:22 README.rst
drwxr-xr-x 5 root root 4096 Mar 17 13:24 spec

———————————————————————————————————–

[root@puppetmaster ~]# cat /etc/puppet/modules/ssh/manifests/init.pp
# See README.md for details.
class ssh {

$package_name = $::osfamily ? {
‘Debian’ => ‘ssh’,
‘RedHat’ => ‘openssh’,
}

package {‘ssh’:
ensure => present,
name => $package_name,
}

$service_name = $::osfamily ? {
‘Debian’ => ‘ssh’,
‘RedHat’ => ‘sshd’,
}

service {‘ssh’:
ensure => running,
name => $service_name,
hasrestart => true,
pattern => ‘/usr/sbin/sshd’,
require => Package[‘ssh’],
}

file {‘/etc/ssh/ssh_known_hosts’:
ensure => file,
mode => ‘0644’,
owner => ‘root’,
}

}

 

 

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