aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sympa/manifests/list.pp
blob: 7b613297a540e44877c5437c3d69fad27e943fad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
define sympa::list( $subject,
                    $profile = false,
                    $language = 'en',
                    $topics = false,
                    $reply_to = false,
                    $sender_email = false,
                    $sender_ldap_group = false,
                    $subscriber_ldap_group = false,
                    $public_archive = true,
                    $subscription_open = false) {

    include sympa::variable
    $ldap_password = extlookup('sympa_ldap','x')
    $custom_subject = $name

    $xml_file = "/etc/sympa/lists_xml/$name.xml"

    if $sender_email {
        $sender_email_file = regsubst($sender_email,'\@','-at-')
    } else {
        $sender_email_file = ''
    }

    file { $xml_file:
        content => template('sympa/list.xml'),
        require => Package[sympa],
    }

    exec { "sympa.pl --create_list --robot=$sympa::variable::vhost --input_file=$xml_file":
        require => File[$xml_file],
        creates => "/var/lib/sympa/expl/$name",
        before  => File["/var/lib/sympa/expl/$name/config"],
    }

    file { "/var/lib/sympa/expl/$name/config":
        owner   => 'sympa',
        group   => 'sympa',
        mode    => '0750',
        content => template('sympa/config'),
        notify  => Service['sympa'],
    }

    if $sender_ldap_group {
        sympa::scenario::sender_ldap_group { $name:
            ldap_group => $sender_ldap_group,
        }
    }

    if $sender_email {
        sympa::scenario::sender_email { $name:
            email => $sender_email,
        }
    }

    if $subscriber_ldap_group {
        if ! defined(Sympa::Search_filter::Ldap[$subscriber_ldap_group]) {
            sympa::search_filter::ldap { $subscriber_ldap_group: }
        }
    }
}