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

Introduce support for Gentoo #79

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ prosody::user: prosody
prosody::virtualhost_defaults: {}
prosody::virtualhosts: {}

prosody::config_directory: '/etc/prosody'

prosody::community_modules::ensure: present
prosody::community_modules::path: /var/lib/prosody/modules
prosody::community_modules::source: https://hg.prosody.im/prosody-modules/
Expand Down
12 changes: 12 additions & 0 deletions data/os/Gentoo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
prosody::error_log: /var/log/jabber/prosody.err
prosody::group: jabber
prosody::info_log: /var/log/jabber/prosody.log
prosody::pidfile: /run/jabber/prosody.pid
prosody::user: jabber

prosody::config_directory: '/etc/jabber'

prosody::community_modules::ensure: present
prosody::community_modules::path: /usr/lib64/prosody/community-modules
prosody::community_modules::type: os
20 changes: 14 additions & 6 deletions manifests/community_modules.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,28 @@
Enum[present, latest] $ensure,
Stdlib::Absolutepath $path,
String $source,
Enum['hg', 'git'] $type,
Enum['hg', 'git', 'os'] $type,
Optional[String] $revision = undef,
) {
if $type == 'hg' {
$_packages = ['mercurial']
} elsif $type == 'git' {
$_packages = ['git']
} elsif $type == 'os' {
$_packages = ['net-im/prosody-modules']
smortex marked this conversation as resolved.
Show resolved Hide resolved
}

ensure_packages($_packages)
-> vcsrepo { $path:
ensure => $ensure,
provider => $type,
source => $source,
revision => $revision,
case $type {
'os': {}
default: {
vcsrepo { $path:
ensure => $ensure,
provider => $type,
source => $source,
revision => $revision,
require => Package[$_packages],
}
}
}
}
6 changes: 3 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# == Class: prosody::config
class prosody::config {
file { '/etc/prosody/conf.avail':
file { "${prosody::config_directory}/conf.avail":
smortex marked this conversation as resolved.
Show resolved Hide resolved
ensure => directory,
}

file { '/etc/prosody/conf.d':
file { "${prosody::config_directory}/conf.d":
ensure => directory,
}

file { '/etc/prosody/prosody.cfg.lua':
file { "${prosody::config_directory}/prosody.cfg.lua":
content => template('prosody/prosody.cfg.erb'),
require => Class['prosody::package'],
notify => Class['prosody::service'],
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
Optional[Stdlib::Absolutepath] $ssl_cert = undef,
Optional[Stdlib::Absolutepath] $ssl_key = undef,
Optional[String] $ssl_protocol = undef,
Optional[Stdlib::Absolutepath] $config_directory = undef,
) {
if ($community_modules != []) {
class { 'prosody::community_modules':
Expand Down
26 changes: 13 additions & 13 deletions manifests/virtualhost.pp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# == Type: prosody::virtualhost
define prosody::virtualhost (
Hash $custom_options = {},
Enum[present, absent] $ensure = present,
Optional[Stdlib::Absolutepath] $ssl_key = undef,
Optional[Stdlib::Absolutepath] $ssl_cert = undef,
Boolean $ssl_copy = true,
Optional[String] $user = undef,
Optional[String] $group = undef,
Hash $components = {},
Array[String[1]] $disco_items = [],
Hash $custom_options = {},
Enum[present, absent] $ensure = present,
Optional[Stdlib::Absolutepath] $ssl_key = undef,
Optional[Stdlib::Absolutepath] $ssl_cert = undef,
Boolean $ssl_copy = true,
Optional[String] $user = undef,
Optional[String] $group = undef,
Hash $components = {},
Array[String[1]] $disco_items = [],
) {
# Check if SSL set correctly
if (($ssl_key != undef) and ($ssl_cert == undef)) {
Expand All @@ -20,8 +20,8 @@

if (($ssl_key != undef) and ($ssl_cert != undef) and ($ssl_copy == true)) {
# Copy the provided sources to prosody certs folder
$prosody_ssl_key = "/etc/prosody/certs/${name}.key"
$prosody_ssl_cert = "/etc/prosody/certs/${name}.crt"
$prosody_ssl_key = "${prosody::config_directory}/certs/${name}.key"
smortex marked this conversation as resolved.
Show resolved Hide resolved
$prosody_ssl_cert = "${prosody::config_directory}/certs/${name}.crt"

$file_user = pick_default($user, 'prosody')
$file_group = pick_default($group, 'prosody')
Expand Down Expand Up @@ -53,7 +53,7 @@
$config_requires = Class['prosody::package']
}

$conf_avail_fn = "/etc/prosody/conf.avail/${name}.cfg.lua"
$conf_avail_fn = "${prosody::config_directory}/conf.avail/${name}.cfg.lua"

file { $conf_avail_fn:
ensure => $ensure,
Expand All @@ -67,7 +67,7 @@
'absent' => absent,
}

file { "/etc/prosody/conf.d/${name}.cfg.lua":
file { "${prosody::config_directory}/conf.d/${name}.cfg.lua":
ensure => $cfg_ensure,
target => $conf_avail_fn,
notify => Class['prosody::service'],
Expand Down