Add Archlinux support
This commit adds Archlinux support. This needs changes in nginx.conf.erb template and manifests to support pid value set to `false` (this skips it from nginx.conf). This is due to `-pid /run/nginx.pid` being hardcoded to Archlinux template. If you specify pid additionally in `nginx.conf` then nginx fails to start.
This commit is contained in:
parent
35a71ad2d3
commit
949a000e80
4 changed files with 41 additions and 3 deletions
|
@ -49,6 +49,12 @@ class nginx::package(
|
||||||
before => Anchor['nginx::package::end'],
|
before => Anchor['nginx::package::end'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
'archlinux': {
|
||||||
|
class { 'nginx::package::archlinux':
|
||||||
|
require => Anchor['nginx::package::begin'],
|
||||||
|
before => Anchor['nginx::package::end'],
|
||||||
|
}
|
||||||
|
}
|
||||||
'Solaris': {
|
'Solaris': {
|
||||||
class { 'nginx::package::solaris':
|
class { 'nginx::package::solaris':
|
||||||
package_name => $package_name,
|
package_name => $package_name,
|
||||||
|
|
25
manifests/package/archlinux.pp
Normal file
25
manifests/package/archlinux.pp
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# 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,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -78,7 +78,12 @@ class nginx::params {
|
||||||
}
|
}
|
||||||
|
|
||||||
$nx_pid = $::kernel ? {
|
$nx_pid = $::kernel ? {
|
||||||
/(?i-mx:linux)/ => '/var/run/nginx.pid',
|
/(?i-mx:linux)/ => $::osfamily ? {
|
||||||
|
# archlinux has hardcoded pid in service file to /run/nginx.pid, setting
|
||||||
|
# it will prevent nginx from starting
|
||||||
|
/(?i-mx:archlinux)/ => false,
|
||||||
|
default => '/var/run/nginx.pid',
|
||||||
|
},
|
||||||
/(?i-mx:sunos)/ => '/var/run/nginx.pid',
|
/(?i-mx:sunos)/ => '/var/run/nginx.pid',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,14 +98,16 @@ class nginx::params {
|
||||||
default => 'webservd',
|
default => 'webservd',
|
||||||
}
|
}
|
||||||
$nx_daemon_user = $::osfamily ? {
|
$nx_daemon_user = $::osfamily ? {
|
||||||
|
/(?i-mx:archlinux)/ => 'http',
|
||||||
/(?i-mx:redhat|suse|gentoo|linux)/ => 'nginx',
|
/(?i-mx:redhat|suse|gentoo|linux)/ => 'nginx',
|
||||||
/(?i-mx:debian)/ => 'www-data',
|
/(?i-mx:debian)/ => 'www-data',
|
||||||
/(?i-mx:solaris)/ => $solaris_nx_daemon_user,
|
/(?i-mx:solaris)/ => $solaris_nx_daemon_user,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warning('$::osfamily not defined. Support for $::operatingsystem is deprecated')
|
warning('$::osfamily not defined. Support for $::operatingsystem is deprecated')
|
||||||
warning("Please upgrade from factor ${::facterversion} to >= 1.7.2")
|
warning("Please upgrade from facter ${::facterversion} to >= 1.7.2")
|
||||||
$nx_daemon_user = $::operatingsystem ? {
|
$nx_daemon_user = $::operatingsystem ? {
|
||||||
|
/(?i-mx:archlinux)/ => 'http',
|
||||||
/(?i-mx:debian|ubuntu)/ => 'www-data',
|
/(?i-mx:debian|ubuntu)/ => 'www-data',
|
||||||
/(?i-mx:fedora|rhel|redhat|centos|scientific|suse|opensuse|amazon|gentoo|oraclelinux)/ => 'nginx',
|
/(?i-mx:fedora|rhel|redhat|centos|scientific|suse|opensuse|amazon|gentoo|oraclelinux)/ => 'nginx',
|
||||||
/(?i-mx:solaris)/ => 'webservd',
|
/(?i-mx:solaris)/ => 'webservd',
|
||||||
|
|
|
@ -3,7 +3,7 @@ worker_processes <%= @worker_processes %>;
|
||||||
worker_rlimit_nofile <%= @worker_rlimit_nofile %>;
|
worker_rlimit_nofile <%= @worker_rlimit_nofile %>;
|
||||||
|
|
||||||
error_log <%= @nginx_error_log %>;
|
error_log <%= @nginx_error_log %>;
|
||||||
pid <%= scope.lookupvar('nginx::params::nx_pid')%>;
|
<% if scope.lookupvar('nginx::params::nx_pid') != false %>pid <%= scope.lookupvar('nginx::params::nx_pid')%>;<% end -%>
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections <%= @worker_connections -%>;
|
worker_connections <%= @worker_connections -%>;
|
||||||
|
|
Loading…
Reference in a new issue