1 |
class transifex { |
2 |
include django_application |
3 |
package { 'transifex': |
4 |
ensure => installed |
5 |
} |
6 |
|
7 |
$pgsql_password = extlookup("transifex_pgsql",'x') |
8 |
$ldap_password = extlookup("transifex_ldap",'x') |
9 |
|
10 |
$templates_dir = "/var/lib/transifex/templates" |
11 |
|
12 |
postgresql::remote_db_and_user { 'transifex': |
13 |
description => "Transifex database", |
14 |
password => $pgsql_password, |
15 |
} |
16 |
|
17 |
file { "20-engines.conf": |
18 |
path => "/etc/transifex/20-engines.conf", |
19 |
ensure => present, |
20 |
owner => root, |
21 |
group => apache, |
22 |
mode => 640, |
23 |
content => template("transifex/20-engines.conf"), |
24 |
require => Package['transifex'], |
25 |
notify => Service['apache'] |
26 |
} |
27 |
|
28 |
file { "30-site.conf": |
29 |
path => "/etc/transifex/30-site.conf", |
30 |
ensure => present, |
31 |
owner => root, |
32 |
group => root, |
33 |
mode => 644, |
34 |
content => template("transifex/30-site.conf"), |
35 |
require => Package['transifex'], |
36 |
notify => Service['apache'] |
37 |
} |
38 |
|
39 |
file { "40-apps.conf": |
40 |
path => "/etc/transifex/40-apps.conf", |
41 |
ensure => present, |
42 |
owner => root, |
43 |
group => root, |
44 |
mode => 644, |
45 |
content => template("transifex/40-apps.conf"), |
46 |
require => Package['transifex'], |
47 |
notify => Service['apache'] |
48 |
} |
49 |
|
50 |
file { "45-ldap.conf": |
51 |
path => "/etc/transifex/45-ldap.conf", |
52 |
ensure => present, |
53 |
owner => root, |
54 |
group => root, |
55 |
mode => 644, |
56 |
content => template("transifex/45-ldap.conf"), |
57 |
require => Package['transifex'], |
58 |
notify => Service['apache'] |
59 |
} |
60 |
|
61 |
file { "50-project.conf": |
62 |
path => "/etc/transifex/50-project.conf", |
63 |
ensure => present, |
64 |
owner => root, |
65 |
group => root, |
66 |
mode => 644, |
67 |
content => template("transifex/50-project.conf"), |
68 |
require => Package['transifex'], |
69 |
notify => Service['apache'] |
70 |
} |
71 |
|
72 |
subversion::snapshot { $templates_dir: |
73 |
source => "svn://svn.mageia.org/svn/web/templates/transifex/trunk" |
74 |
} |
75 |
|
76 |
apache::vhost_django_app { "transifex.$domain": |
77 |
module => "transifex", |
78 |
use_ssl => true, |
79 |
module_path => ["/usr/share/transifex","/usr/share","/usr/local/lib/"], |
80 |
aliases => { "/site_media/static/admin/" => "/usr/lib/python2.6/site-packages/django/contrib/admin/media/", }, |
81 |
} |
82 |
|
83 |
apache::vhost_redirect_ssl { "transifex.$domain": } |
84 |
|
85 |
# the group are mapped from ldap, since AUTH_LDAP_FIND_GROUP_PERMS is set to yes |
86 |
# but the group need to exist in django first |
87 |
django_application::create_group { ["mga-i18n","mga-i18n-committers"]: |
88 |
module => "transifex", |
89 |
path => "/usr/share/transifex:/usr/share", |
90 |
} |
91 |
|
92 |
define committers_permission($app='') |
93 |
{ |
94 |
# using django_application::add_permission_to_group may cause problem |
95 |
# if we install a 2nd django application with the same permission name ( as it need |
96 |
# to be unique ) |
97 |
django_application::add_permission_to_group { $name: |
98 |
app => $app, |
99 |
group => 'mga-i18n-committers', |
100 |
module => "transifex", |
101 |
path => "/usr/share/transifex:/usr/share", |
102 |
require => Django_application::Create_group['mga-i18n-committers'], |
103 |
} |
104 |
} |
105 |
|
106 |
committers_permission { ['add_project', |
107 |
'change_project', |
108 |
'delete_project']: } |
109 |
|
110 |
committers_permission { [ 'add_resource', |
111 |
'change_resource', |
112 |
'delete_resource']: |
113 |
app => "resources", |
114 |
} |
115 |
} |