hastymail: Added datadir parameter

This commit is contained in:
Ossi Salmi 2013-08-31 18:04:00 +03:00
parent 20e9361e20
commit 7af13184e8

View file

@ -1,20 +1,16 @@
# Install and configure Hastymail.
#
# === Parameters
#
# $datadir:
# Data directory. Defaults to /srv/hastymail.
#
class hastymail($datadir=undef) {
class hastymail {
case $::operatingsystem {
"ubuntu","debian": {
package { ["php5", "php5-cli", "php5-common",
"php5-imap", "php5-ldap", "php5-mcrypt"]:
ensure => installed,
}
}
"centos","redhat","fedora": {
}
default: {
fail("cyrus not supported on ${::operatingsystem}")
}
}
include php::cli
include php::imap
include php::ldap
include php::mcrypt
if !$hastymail_package {
if $hastymail_package_latest {
@ -24,6 +20,47 @@ class hastymail {
}
}
if $datadir {
file { $datadir:
ensure => directory,
mode => "0750",
owner => "root",
group => $apache::sslserver::group,
seltype => "httpd_sys_rw_content_t",
}
selinux::manage_fcontext { "${datadir}(/.*)?":
type => "httpd_sys_rw_content_t",
before => File[$datadir],
}
file { "/srv/hastymail":
ensure => link,
target => $datadir,
seltype => "httpd_sys_rw_content_t",
require => File[$datadir],
}
} else {
file { "/srv/hastymail":
ensure => directory,
mode => "0750",
owner => "root",
group => $apache::sslserver::group,
seltype => "httpd_sys_rw_content_t",
}
}
selinux::manage_fcontext { "/srv/hastymail(/.*)?":
type => "httpd_sys_rw_content_t",
before => File["/srv/hastymail"],
}
file { [ "/srv/hastymail/attachments",
"/srv/hastymail/settings", ]:
ensure => directory,
mode => "0770",
owner => "root",
group => $apache::sslserver::group,
seltype => "httpd_sys_rw_content_t",
}
file { "/usr/local/src/hastymail.tar.gz":
ensure => present,
source => "puppet:///files/packages/${hastymail_package}",
@ -68,4 +105,3 @@ class hastymail {
}
}