Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Solaris support #94

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ is_ruby18 = RUBY_VERSION.start_with? '1.8'

if is_ruby18
gem 'rspec', "~> 3.1.0", :require => false
gem 'rake', '~> 10.5.0', :require => false
end
gem 'puppet', puppetversion, :require => false
gem 'puppet-lint'
Expand Down
4 changes: 2 additions & 2 deletions manifests/htpasswd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@
if $crypt_password {
exec { "test -f ${real_htpasswd_file} || OPT='-c'; htpasswd -b \${OPT} ${real_htpasswd_file} ${username} '${crypt_password}'":
unless => "grep -q '${username}:${crypt_password}' ${real_htpasswd_file}",
path => '/bin:/sbin:/usr/bin:/usr/sbin',
path => '/bin:/sbin:/usr/bin:/usr/sbin:/opt/csw/bin',
}
}

if $clear_password {
exec { "test -f ${real_htpasswd_file} || OPT='-c'; htpasswd -bp \$OPT ${real_htpasswd_file} ${username} ${clear_password}":
unless => "egrep '^${username}:' ${real_htpasswd_file} && grep ${username}:\$(mkpasswd -S \$(egrep '^${username}:' ${real_htpasswd_file} |cut -d : -f 2 |cut -c-2) ${clear_password}) ${real_htpasswd_file}",
path => '/bin:/sbin:/usr/bin:/usr/sbin',
path => '/bin:/sbin:/usr/bin:/usr/sbin:/opt/csw/bin',
}
}
}
Expand Down
1 change: 1 addition & 0 deletions manifests/module.pp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
$modpackage_basename = $::operatingsystem ? {
/(?i:Ubuntu|Debian|Mint)/ => 'libapache2-mod-',
/(?i:SLES|OpenSuSE)/ => 'apache2-mod_',
/(?i:Solaris)/ => 'apache-',
default => 'mod_',
}

Expand Down
34 changes: 34 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
$package_modssl = $::operatingsystem ? {
/(?i:Ubuntu|Debian|Mint)/ => 'libapache-mod-ssl',
/(?i:SLES|OpenSuSE)/ => undef,
/(?i:Solaris)/ => $::operatingsystemmajrelease ? {
'11' => 'web/server/apache-24/module/apache-ssl',
},
default => 'mod_ssl',
}

Expand All @@ -26,12 +29,20 @@
$package = $::operatingsystem ? {
/(?i:Ubuntu|Debian|Mint)/ => 'apache2',
/(?i:SLES|OpenSuSE)/ => 'apache2',
/(?i:Solaris)/ => $::operatingsystemmajrelease ? {
'10' => 'apache24',
'11' => 'web/server/apache-24',
},
default => 'httpd',
}

$service = $::operatingsystem ? {
/(?i:Ubuntu|Debian|Mint)/ => 'apache2',
/(?i:SLES|OpenSuSE)/ => 'apache2',
/(?i:Solaris)/ => $::operatingsystemmajrelease ? {
'10' => 'svc:/network/cswapache24:default',
'11' => 'svc:/network/http:apache24',
},
default => 'httpd',
}

Expand All @@ -52,19 +63,25 @@
$process_user = $::operatingsystem ? {
/(?i:Ubuntu|Debian|Mint)/ => 'www-data',
/(?i:SLES|OpenSuSE)/ => 'wwwrun',
/(?i:Solaris)/ => 'webservd',
default => 'apache',
}

$config_dir = $::operatingsystem ? {
/(?i:Ubuntu|Debian|Mint)/ => '/etc/apache2',
/(?i:SLES|OpenSuSE)/ => '/etc/apache2',
/(?i:Solaris)/ => $::operatingsystemmajrelease ? {
'10' => '/etc/apache2',
'11' => '/etc/apache2/2.4',
},
freebsd => '/usr/local/etc/apache20',
default => '/etc/httpd',
}

$config_file = $::operatingsystem ? {
/(?i:Ubuntu|Debian|Mint)/ => '/etc/apache2/apache2.conf',
/(?i:SLES|OpenSuSE)/ => '/etc/apache2/httpd.conf',
/(?i:Solaris)/ => "${config_dir}/httpd.conf",
freebsd => '/usr/local/etc/apache20/httpd.conf',
default => '/etc/httpd/conf/httpd.conf',
}
Expand All @@ -85,30 +102,47 @@
$config_file_init = $::operatingsystem ? {
/(?i:Debian|Ubuntu|Mint)/ => '/etc/default/apache2',
/(?i:SLES|OpenSuSE)/ => '/etc/sysconfig/apache2',
/(?i:Solaris)/ => undef,
default => '/etc/sysconfig/httpd',
}

$pid_file = $::operatingsystem ? {
/(?i:Debian|Ubuntu|Mint)/ => '/var/run/apache2.pid',
/(?i:SLES|OpenSuSE)/ => '/var/run/httpd2.pid',
/(?i:Solaris)/ => $::operatingsystemmajrelease ? {
'10' => '/var/run/apache2/httpd.pid',
'11' => '/usr/apache2/2.4/httpd.pid',
},
default => '/var/run/httpd.pid',
}

$log_dir = $::operatingsystem ? {
/(?i:Debian|Ubuntu|Mint)/ => '/var/log/apache2',
/(?i:SLES|OpenSuSE)/ => '/var/log/apache2',
/(?i:Solaris)/ => $::operatingsystemmajrelease ? {
'10' => '/var/apache2/logs',
'11' => '/var/apache2/2.4/logs',
},
default => '/var/log/httpd',
}

$log_file = $::operatingsystem ? {
/(?i:Debian|Ubuntu|Mint)/ => ['/var/log/apache2/access.log','/var/log/apache2/error.log'],
/(?i:SLES|OpenSuSE)/ => ['/var/log/apache2/access.log','/var/log/apache2/error.log'],
/(?i:Solaris)/ => $::operatingsystemmajrelease ? {
'10' => ['/var/apache2/logs/access.log','/var/apache2/logs/error.log'],
'11' => ['/var/apache2/2.4/logs/access.log', '/var/apache2/2.4/logs/error.log'],
},
default => ['/var/log/httpd/access.log','/var/log/httpd/error.log'],
}

$data_dir = $::operatingsystem ? {
/(?i:Debian|Ubuntu|Mint)/ => '/var/www',
/(?i:Suse|OpenSuse)/ => '/srv/www/htdocs',
/(?i:Solaris)/ => $::operatingsystemmajrelease ? {
'10' => '/var/apache2/htdocs',
'11' => '/var/apache2/2.4/htdocs',
},
default => '/var/www/html',
}

Expand Down
15 changes: 15 additions & 0 deletions manifests/ssl.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
}
}

solaris: {
if $::operatingsystemmajrelease == '11' {
package { 'apache-ssl':
ensure => present,
require => Package['apache'],
notify => Service['apache'],
}
file { "${apache::dotconf_dir}/ssl.conf":
mode => '0644',
owner => 'root',
group => 'root',
notify => Service['apache'],
}
}
}
default: {
package { 'mod_ssl':
ensure => present,
Expand Down
9 changes: 8 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "example42-apache",
"version": "2.1.12",
"version": "2.2.0",
"summary": "Puppet module for apache",
"license": "Apache-2.0",
"author": "Alessandro Franceschi, Martin Alfke",
Expand Down Expand Up @@ -33,6 +33,13 @@
"operatingsystemrelease": [
"14.04"
]
},
{
"operatingsystem": "Solaris",
"operatingsystemrelease": [
"10",
"11"
]
}
],
"requirements": [
Expand Down
20 changes: 20 additions & 0 deletions spec/defines/apache_virtualhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@

end

describe 'Test apache::virtualhost on solaris' do
let(:facts) { { :arch => 'i386' , :operatingsystem => 'Solaris', :operatingsystemmajrelease => '11' } }
let(:params) {
{ 'enable' => 'true',
'name' => 'www.example42.com',
}
}

it 'should populate correctly the apache::virtualhost file DocumentRoot' do
should contain_file('ApacheVirtualHost_www.example42.com').with_content(/ DocumentRoot \/var\/apache2\/2.4\/htdocs\/www.example42.com/)
end
it 'should populate correctly the apache::virtualhost file ErrorLog' do
should contain_file('ApacheVirtualHost_www.example42.com').with_content(/ ErrorLog \/var\/apache2\/2.4\/logs\/www.example42.com-error_log/)
end
it 'should create the docroot directory' do
should contain_file('/var/apache2/2.4/htdocs/www.example42.com').with_ensure("directory")
end

end

describe 'Test apache::virtualhost decommissioning' do
let(:params) {
{ 'enable' => 'false',
Expand Down