Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacement of file fragment pattern with pupmod-concat #2

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name 'jfryman-nginx'
name 'puppetlabs-nginx'
version '0.0.1'
source 'http://github.com/jfryman/puppet-nginx'
author 'James Fryman'
license 'Apache 2'
source 'http://github.com/puppetlabs/puppetlabs-nginx'
author 'puppetlabs'
license 'Apache License Version 2.0'
summary 'Puppet NGINX management module'
description 'This module can be used for basic NGINX Management'
project_page 'http://github.com/jfryman/puppet-nginx'
project_page 'http://github.com/puppetlabs/puppetlabs-nginx'

dependency 'puppetlabs/stdlib', '>= 0.1.6'
10 changes: 9 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@ This module manages NGINX from within Puppet.

Install and bootstrap an NGINX instance

<pre>
node default {
class { 'nginx': }
}
</pre>

Setup a new virtual host

<pre>
node default {
class { 'mcollective': }
nginx::resource::vhost { 'www.puppetlabs.com':
ensure => present,
www_root => '/var/www/www.puppetlabs.com',
}
}
</pre>

Add a Proxy Server(s)

<pre>
node default {
class { 'mcollective': }
nginx::resource::upstream { 'puppet_rack_app':
Expand All @@ -33,8 +39,10 @@ Add a Proxy Server(s)
'localhost:3002',
],
}

nginx::resource::vhost { 'rack.puppetlabs.com':
ensure => present,
proxy => 'http://puppet_rack_app',
}
}
}
</pre>
102 changes: 51 additions & 51 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# This module manages NGINX bootstrap and configuration
#
# Parameters:
#
# There are no default parameters for this class.
#
# There are no default parameters for this class.
#
# Actions:
#
Expand All @@ -13,52 +13,52 @@
# Sample Usage:
#
# This class file is not called directly
class nginx::config inherits nginx::params {
File {
owner => 'root',
group => 'root',
mode => '0644',
}
file { "${nginx::params::nx_conf_dir}":
ensure => directory,
}
file { "${nginx::params::nx_conf_dir}/conf.d":
ensure => directory,
}
file { "${nginx::config::nx_run_dir}":
ensure => directory,
}
file { "${nginx::config::nx_client_body_temp_path}":
ensure => directory,
owner => $nginx::params::nx_daemon_user,
}
file {"${nginx::config::nx_proxy_temp_path}":
ensure => directory,
owner => $nginx::params::nx_daemon_user,
}
file { '/etc/nginx/sites-enabled/default':
ensure => absent,
}
file { "${nginx::params::nx_conf_dir}/nginx.conf":
ensure => file,
content => template('nginx/conf.d/nginx.conf.erb'),
}
file { "${nginx::params::nx_conf_dir}/conf.d/proxy.conf":
ensure => file,
content => template('nginx/conf.d/proxy.conf.erb'),
}
file { "${nginx::config::nx_temp_dir}/nginx.d":
ensure => directory,
purge => true,
recurse => true,
}
}
class nginx::config inherits nginx::params {
File {
owner => 'root',
group => 'root',
mode => '0644',
}

file { "${nginx::params::nx_conf_dir}":
ensure => directory,
}

file { "${nginx::params::nx_conf_dir}/conf.d":
ensure => directory,
}

file { "${nginx::config::nx_run_dir}":
ensure => directory,
}

file { "${nginx::config::nx_client_body_temp_path}":
ensure => directory,
owner => $nginx::params::nx_daemon_user,
}

file {"${nginx::config::nx_proxy_temp_path}":
ensure => directory,
owner => $nginx::params::nx_daemon_user,
}

file { '/etc/nginx/sites-enabled/default':
ensure => absent,
}

file { "${nginx::params::nx_conf_dir}/nginx.conf":
ensure => file,
content => template('nginx/conf.d/nginx.conf.erb'),
}

file { "${nginx::params::nx_conf_dir}/conf.d/proxy.conf":
ensure => file,
content => template('nginx/conf.d/proxy.conf.erb'),
}

file { "${nginx::config::nx_temp_dir}/nginx.d":
ensure => directory,
purge => true,
recurse => true,
}
}
37 changes: 31 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@
# 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
# pupmod-concat - https://github.com/zertico/pupmod-concat
#
# 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:
Expand All @@ -24,9 +30,28 @@
# include nginx
# }
class nginx {
include nginx::package
include nginx::config
include nginx::service

Class['nginx::package'] -> Class['nginx::config'] ~> Class['nginx::service']

class { 'stdlib': }

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

class { 'nginx::config':
require => Class['nginx::package'],
notify => Class['nginx::service'],
}

class { 'nginx::service': }

# 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'],
}
}
24 changes: 18 additions & 6 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# This module manages NGINX package installation
#
# Parameters:
#
# There are no default parameters for this class.
#
# There are no default parameters for this class.
#
# Actions:
#
Expand All @@ -14,15 +14,27 @@
#
# This class file is not called directly
class nginx::package {
anchor { 'nginx::package::begin': }
anchor { 'nginx::package::end': }

case $operatingsystem {
centos,fedora,rhel: {
include nginx::package::redhat
class { 'nginx::package::redhat':
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
debian,ubuntu: {
include nginx::package::debian
class { 'nginx::package::debian':
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
opensuse,suse: {
include nginx::package::suse
class { 'nginx::package::suse':
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
}
}
}
12 changes: 6 additions & 6 deletions manifests/package/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# This module manages NGINX package installation on debian based systems
#
# Parameters:
#
# There are no default parameters for this class.
#
# There are no default parameters for this class.
#
# Actions:
#
Expand All @@ -14,7 +14,7 @@
#
# This class file is not called directly
class nginx::package::debian {
package { 'nginx':
ensure => present,
}
}
package { 'nginx':
ensure => present,
}
}
25 changes: 7 additions & 18 deletions manifests/package/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# This module manages NGINX package installation on RedHat based systems
#
# Parameters:
#
# There are no default parameters for this class.
#
# There are no default parameters for this class.
#
# Actions:
#
Expand All @@ -14,19 +14,8 @@
#
# This class file is not called directly
class nginx::package::redhat {
package { 'nginx':
ensure => present,
}
package { 'GeoIP':
ensure => present,
}
package { 'gd':
ensure => present,
}
package { 'libXpm':
ensure => present,
}
package { 'libxslt':
ensure => present,
}
}
$redhat_packages = ['nginx', 'GeoIP', 'gd', 'libXpm', 'libxslt']
package { $redhat_packages:
ensure => present,
}
}
Loading