package: refactor
This commit is contained in:
parent
4eea8c7397
commit
5b09b23b12
9 changed files with 18 additions and 167 deletions
|
@ -100,7 +100,7 @@ class nginx (
|
|||
|
||||
### START Package Configuration ###
|
||||
$package_ensure = present,
|
||||
$package_name = 'nginx',
|
||||
$package_name = $::nginx::params::package_name,
|
||||
$package_source = 'nginx',
|
||||
$manage_repo = true,
|
||||
### END Package Configuration ###
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
#
|
||||
# This class file is not called directly
|
||||
class nginx::package(
|
||||
$package_name = 'nginx',
|
||||
$package_name = $::nginx::params::package_name,
|
||||
$package_source = 'nginx',
|
||||
$package_ensure = 'present',
|
||||
$manage_repo = true,
|
||||
) {
|
||||
) inherits ::nginx::params {
|
||||
|
||||
anchor { 'nginx::package::begin': }
|
||||
anchor { 'nginx::package::end': }
|
||||
|
@ -43,50 +43,13 @@ class nginx::package(
|
|||
before => Anchor['nginx::package::end'],
|
||||
}
|
||||
}
|
||||
'suse': {
|
||||
class { '::nginx::package::suse':
|
||||
package_name => $package_name,
|
||||
require => Anchor['nginx::package::begin'],
|
||||
before => Anchor['nginx::package::end'],
|
||||
}
|
||||
}
|
||||
'archlinux': {
|
||||
class { '::nginx::package::archlinux':
|
||||
require => Anchor['nginx::package::begin'],
|
||||
before => Anchor['nginx::package::end'],
|
||||
}
|
||||
}
|
||||
'Solaris': {
|
||||
class { '::nginx::package::solaris':
|
||||
package_name => $package_name,
|
||||
package_source => $package_source,
|
||||
package_ensure => $package_ensure,
|
||||
require => Anchor['nginx::package::begin'],
|
||||
before => Anchor['nginx::package::end'],
|
||||
}
|
||||
}
|
||||
'FreeBSD': {
|
||||
class { '::nginx::package::freebsd':
|
||||
package_name => $package_name,
|
||||
package_ensure => $package_ensure,
|
||||
require => Anchor['nginx::package::begin'],
|
||||
before => Anchor['nginx::package::end'],
|
||||
}
|
||||
}
|
||||
'Gentoo': {
|
||||
class { '::nginx::package::gentoo':
|
||||
package_name => $package_name,
|
||||
package_ensure => $package_ensure,
|
||||
require => Anchor['nginx::package::begin'],
|
||||
before => Anchor['nginx::package::end'],
|
||||
}
|
||||
}
|
||||
'OpenBSD': {
|
||||
class { '::nginx::package::openbsd':
|
||||
package_name => $package_name,
|
||||
package_ensure => $package_ensure,
|
||||
require => Anchor['nginx::package::begin'],
|
||||
before => Anchor['nginx::package::end'],
|
||||
# $package_name needs to be specified. SFEnginx,CSWnginx depending on
|
||||
# where you get it.
|
||||
package { 'nginx':
|
||||
ensure => $package_ensure,
|
||||
name => $package_name,
|
||||
source => $package_source,
|
||||
}
|
||||
}
|
||||
default: {
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
# Class: nginx::package::archlinux
|
||||
#
|
||||
# This module manages NGINX package installation on Archlinux based systems
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# There are no default parameters for this class.
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# This class file is not called directly
|
||||
class nginx::package::archlinux(
|
||||
$package_name = 'nginx',
|
||||
$package_ensure = 'present'
|
||||
) {
|
||||
|
||||
package { $package_name:
|
||||
ensure => $package_ensure,
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
# Class: nginx::package::freebsd
|
||||
#
|
||||
# Manage the nginx package on FreeBSD
|
||||
class nginx::package::freebsd (
|
||||
$package_name = 'nginx',
|
||||
$package_ensure = 'present'
|
||||
) {
|
||||
|
||||
package { $package_name:
|
||||
ensure => $package_ensure,
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
# Class: nginx::package::gentoo
|
||||
#
|
||||
# Manage the nginx package on Gentoo
|
||||
class nginx::package::gentoo(
|
||||
$package_name = 'www-servers/nginx',
|
||||
$package_ensure = 'present'
|
||||
) {
|
||||
|
||||
package { $package_name:
|
||||
ensure => $package_ensure,
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
# Class: nginx::package::openbsd
|
||||
#
|
||||
# Manage the nginx package on OpenBSD
|
||||
class nginx::package::openbsd (
|
||||
$package_name = 'nginx',
|
||||
$package_ensure = 'present'
|
||||
) {
|
||||
|
||||
package { $package_name:
|
||||
ensure => $package_ensure,
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
# Class: nginx::package::solaris
|
||||
#
|
||||
# This module manages NGINX package installation on solaris based systems
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# *package_name*
|
||||
# Needs to be specified. SFEnginx,CSWnginx depending on where you get it.
|
||||
#
|
||||
# *package_source*
|
||||
# Needed in case of Solaris 10.
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# This class file is not called directly
|
||||
class nginx::package::solaris(
|
||||
$package_name = undef,
|
||||
$package_source = '',
|
||||
$package_ensure = 'present'
|
||||
){
|
||||
package { $package_name:
|
||||
ensure => $package_ensure,
|
||||
source => $package_source
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
# Class: nginx::package::suse
|
||||
#
|
||||
# This module manages NGINX package installation for SuSE based systems
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# There are no default parameters for this class.
|
||||
#
|
||||
# Actions:
|
||||
# This module contains all of the required package for SuSE. Apache and all
|
||||
# other packages listed below are built into the packaged RPM spec for
|
||||
# SuSE and OpenSuSE.
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# This class file is not called directly
|
||||
class nginx::package::suse (
|
||||
$package_name = 'nginx'
|
||||
) {
|
||||
|
||||
if $caller_module_name != $module_name {
|
||||
warning("${name} is deprecated as a public API of the ${module_name} module and should no longer be directly included in the manifest.")
|
||||
}
|
||||
|
||||
package { $package_name:
|
||||
ensure => $::nginx::package_ensure,
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ class nginx::params {
|
|||
'root_group' => 'root',
|
||||
'log_dir' => '/var/log/nginx',
|
||||
'run_dir' => '/var/nginx',
|
||||
'package_name' => 'nginx',
|
||||
}
|
||||
case $::osfamily {
|
||||
'ArchLinux': {
|
||||
|
@ -28,9 +29,15 @@ class nginx::params {
|
|||
'root_group' => 'wheel',
|
||||
}
|
||||
}
|
||||
'Gentoo': {
|
||||
$_module_os_overrides = {
|
||||
'package_name' => 'www-servers/nginx',
|
||||
}
|
||||
}
|
||||
'Solaris': {
|
||||
$_module_os_overrides = {
|
||||
'daemon_user' => 'webservd',
|
||||
'daemon_user' => 'webservd',
|
||||
'package_name' => undef,
|
||||
}
|
||||
}
|
||||
'OpenBSD': {
|
||||
|
@ -73,6 +80,7 @@ class nginx::params {
|
|||
$http_access_log = "${log_dir}/access.log"
|
||||
$nginx_error_log = "${log_dir}/error.log"
|
||||
$root_group = $_module_parameters['root_group']
|
||||
$package_name = $_module_parameters['package_name']
|
||||
$proxy_temp_path = "${run_dir}/proxy_temp"
|
||||
$sites_available_owner = 'root'
|
||||
$sites_available_group = $_module_parameters['root_group']
|
||||
|
|
Loading…
Reference in a new issue