OLD | NEW |
(Empty) | |
| 1 class trac( |
| 2 $domain, |
| 3 $is_default = false) inherits private::trac { |
| 4 package {['python-mysqldb','python-pip','subversion', 'tofrodos', 'graphviz']: |
| 5 ensure => present |
| 6 } |
| 7 |
| 8 include nginx, spawn-fcgi |
| 9 |
| 10 nginx::hostconfig {$domain: |
| 11 content => template('trac/site.erb'), |
| 12 enabled => true |
| 13 } |
| 14 |
| 15 user {'trac': |
| 16 ensure => present, |
| 17 comment => 'User of the trac installation', |
| 18 home => '/home/trac', |
| 19 managehome => true |
| 20 } |
| 21 |
| 22 class {'mysql::server': |
| 23 root_password => $database_root_password |
| 24 } |
| 25 |
| 26 mysql::db {'trac': |
| 27 user => 'trac', |
| 28 password => $database_password, |
| 29 host => 'localhost', |
| 30 grant => ['all'], |
| 31 charset => 'utf8', |
| 32 collate => 'utf8_bin', |
| 33 require => Class['mysql::server'] |
| 34 } |
| 35 |
| 36 Exec { |
| 37 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', |
| 38 } |
| 39 |
| 40 exec { 'install_trac': |
| 41 command => "pip install Trac==1.0", |
| 42 require => Package['python-pip'], |
| 43 unless => "python -c 'import trac,sys;sys.exit(0 if trac.__version__ == \"1.
0\" else 1)'", |
| 44 } |
| 45 |
| 46 exec { 'trac_env': |
| 47 command => "trac-admin /home/trac/environment initenv \"Adblock Plus issue t
racker\" mysql://trac:${database_password}@localhost:3306/trac", |
| 48 require => [ |
| 49 Exec['install_trac'], |
| 50 Mysql_grant['trac@localhost/trac.*'] |
| 51 ], |
| 52 user => trac, |
| 53 unless => "test -d /home/trac/environment" |
| 54 } |
| 55 |
| 56 exec { 'install_BlackMagicTicketTweaks': |
| 57 command => "pip install svn+http://trac-hacks.org/svn/blackmagictickettweaks
plugin/0.12/", |
| 58 require => Package['subversion', 'python-pip'], |
| 59 unless => "python -c 'import blackmagic'", |
| 60 } |
| 61 |
| 62 exec { 'install_SensitiveTickets': |
| 63 command => "pip install svn+http://trac-hacks.org/svn/sensitiveticketsplugin
/trunk/", |
| 64 require => Package['subversion', 'python-pip'], |
| 65 unless => "python -c 'import sensitivetickets'", |
| 66 } |
| 67 |
| 68 exec { 'install_AccountManager': |
| 69 command => "pip install svn+http://trac-hacks.org/svn/accountmanagerplugin/t
ags/acct_mgr-0.4.3/", |
| 70 require => Package['subversion', 'python-pip'], |
| 71 unless => "python -c 'import acct_mgr'", |
| 72 } |
| 73 |
| 74 exec { 'install_TicketTemplate': |
| 75 command => "pip install svn+http://trac-hacks.org/svn/tractickettemplateplug
in/0.11/", |
| 76 require => Package['subversion', 'python-pip'], |
| 77 unless => "python -c 'import tickettemplate'", |
| 78 } |
| 79 |
| 80 exec { 'install_AutocompleteUsers': |
| 81 command => "pip install svn+http://trac-hacks.org/svn/autocompleteusersplugi
n/trunk/", |
| 82 require => Package['subversion', 'python-pip'], |
| 83 unless => "python -c 'import autocompleteusers'", |
| 84 } |
| 85 |
| 86 exec { 'install_MasterTickets': |
| 87 command => "pip install svn+http://trac-hacks.org/svn/masterticketsplugin/tr
unk/", |
| 88 require => Package['subversion', 'python-pip', 'graphviz'], |
| 89 unless => "python -c 'import mastertickets'", |
| 90 } |
| 91 |
| 92 file {"/home/trac/environment/conf/trac.ini": |
| 93 ensure => present, |
| 94 content => template('trac/trac.ini.erb'), |
| 95 owner => trac, |
| 96 require => Exec['trac_env'] |
| 97 } |
| 98 |
| 99 file {"/home/trac/htdocs/htdocs/common/adblockplus_logo.png": |
| 100 ensure => present, |
| 101 source => 'puppet:///modules/trac/adblockplus_logo.png', |
| 102 owner => trac, |
| 103 require => Exec['deploy'] |
| 104 } |
| 105 |
| 106 exec {"update_env": |
| 107 command => "trac-admin /home/trac/environment upgrade", |
| 108 user => trac, |
| 109 require => [ |
| 110 File['/home/trac/environment/conf/trac.ini'], |
| 111 Exec['install_SensitiveTickets'], |
| 112 Exec['install_BlackMagicTicketTweaks'], |
| 113 Exec['install_AccountManager'], |
| 114 Exec['install_AutocompleteUsers'], |
| 115 Exec['install_TicketTemplate'], |
| 116 Exec['install_MasterTickets']] |
| 117 } |
| 118 |
| 119 exec {"deploy": |
| 120 command => "trac-admin /home/trac/environment deploy /home/trac/htdocs && fr
omdos /home/trac/htdocs/cgi-bin/trac.fcgi && chmod 755 /home/trac/htdocs/cgi-bin
/trac.fcgi", |
| 121 user => trac, |
| 122 require => [ |
| 123 Exec["update_env"], |
| 124 Package["tofrodos"]] |
| 125 } |
| 126 |
| 127 spawn-fcgi::pool {"tracd": |
| 128 ensure => present, |
| 129 fcgi_app => "/home/trac/htdocs/cgi-bin/trac.fcgi", |
| 130 socket => "/tmp/trac-fastcgi.sock", |
| 131 mode => "0666", |
| 132 user => trac, |
| 133 children => 1, |
| 134 require => Exec['deploy'], |
| 135 } |
| 136 |
| 137 file {"/home/trac/permissions.csv": |
| 138 ensure => present, |
| 139 owner => trac, |
| 140 source => 'puppet:///modules/trac/permissions.csv' |
| 141 } |
| 142 |
| 143 } |
OLD | NEW |