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