Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 class roundup($tracker_name, $domain) inherits private::roundup { | |
2 package {['roundup', 'python-mysqldb']: ensure => present} | |
3 | |
4 include nginx | |
5 | |
6 nginx::hostconfig {$domain: | |
7 content => template('roundup/site.erb'), | |
8 enabled => true | |
9 } | |
10 | |
11 include postfix | |
Wladimir Palant
2014/01/22 09:05:29
Why do we need that? It is already included in the
Felix Dahlke
2014/01/22 13:53:58
Done.
| |
12 | |
13 class {'mysql::server': | |
14 config_hash => {'root_password' => $database_root_password} | |
15 } | |
Wladimir Palant
2014/01/22 09:05:29
Any particular reason why we are using MySQL rathe
Felix Dahlke
2014/01/22 13:53:58
Discourse doesn't support MySQL, that's why I went
| |
16 | |
17 mysql::db {'roundup': | |
18 user => 'roundup', | |
19 password => $database_password, | |
20 host => 'localhost', | |
21 grant => ['all'], | |
22 require => Class['mysql::config'] | |
23 } | |
24 | |
25 file {'/etc/roundup/roundup-server.ini': | |
26 ensure => present, | |
27 content => template('roundup/roundup-server.ini.erb'), | |
28 require => Package['roundup'] | |
29 } | |
30 | |
31 $tracker_home = "/var/lib/roundup/trackers/${tracker_name}" | |
32 | |
33 Exec { | |
34 path => ['/bin', '/usr/bin'], | |
35 } | |
36 | |
37 exec {'install': | |
38 command => "roundup-admin -i ${tracker_home} install classic mysql", | |
39 onlyif => "test ! -d ${tracker_home}", | |
40 require => Package['roundup', 'python-mysqldb'] | |
41 } | |
42 | |
43 file {"${tracker_home}/config.ini": | |
44 ensure => present, | |
45 content => template('roundup/config.ini.erb'), | |
46 require => Exec['install'] | |
47 } | |
48 | |
49 $db_path = "${tracker_home}/db" | |
Wladimir Palant
2014/01/22 09:05:29
Nit: move this further down where it is used?
Felix Dahlke
2014/01/22 13:53:58
Done.
| |
50 | |
51 service {'roundup': | |
52 ensure => running, | |
53 hasstatus => false, | |
54 require => Package['roundup'] | |
Wladimir Palant
2014/01/22 09:05:29
Doesn't that require config.ini or at least roundu
Felix Dahlke
2014/01/22 13:53:58
Yes, both apparently. Added a notify to those.
| |
55 } | |
56 | |
57 # The following wrapper script is a hack that solves two problems: | |
58 # 1. roundup-admin initialise insists on user input when initialising the | |
59 # MySQL database. | |
60 # 2. Puppet commands can apparently not do input redirection, hence the | |
61 # wrapper script. It doesn't seem to be possible to create temporary | |
62 # files with Puppet either, so it has to stick around. | |
63 | |
64 $roundup_initialise_wrapper = '/root/roundup-initialise' | |
65 | |
66 file {$roundup_initialise_wrapper: | |
67 content => "echo y | roundup-admin -i ${tracker_home} initialise ${admin_pas sword}" | |
68 } | |
69 | |
70 exec {'initialise': | |
71 command => "bash ${roundup_initialise_wrapper}", | |
Wladimir Palant
2014/01/22 09:05:29
Why use a script file? "bash -c 'echo y | roundup-
Felix Dahlke
2014/01/22 13:53:58
Well that's embarrassing, didn't think of -c. Done
| |
72 onlyif => "test ! -d ${db_path}/lock", | |
73 require => [Package['roundup'], File[$roundup_initialise_wrapper], | |
74 Mysql::Db['roundup']], | |
75 notify => File[$db_path] | |
76 } | |
77 | |
78 file {$db_path: | |
79 owner => 'roundup', | |
80 notify => Service['roundup'] | |
81 } | |
82 } | |
OLD | NEW |