OLD | NEW |
(Empty) | |
| 1 class trac( |
| 2 $domain, |
| 3 $is_default = false) inherits private::trac { |
| 4 package {['python-mysqldb','python-pip','subversion', 'tofrodos']: |
| 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 package { "graphviz": |
| 87 ensure => "installed" |
| 88 } |
| 89 |
| 90 exec { 'install_MasterTickets': |
| 91 command => "pip install svn+http://trac-hacks.org/svn/masterticketsplugin/tr
unk/", |
| 92 require => Package['subversion', 'python-pip', 'graphviz'], |
| 93 unless => "python -c 'import mastertickets'", |
| 94 } |
| 95 |
| 96 file {"/home/trac/environment/conf/trac.ini": |
| 97 ensure => present, |
| 98 content => template('trac/trac.ini.erb'), |
| 99 owner => trac, |
| 100 require => Exec['trac_env'] |
| 101 } |
| 102 |
| 103 file {"/home/trac/htdocs/htdocs/common/adblockplus_logo.png": |
| 104 ensure => present, |
| 105 source => 'puppet:///modules/trac/adblockplus_logo.png', |
| 106 owner => trac, |
| 107 require => Exec['deploy'] |
| 108 } |
| 109 |
| 110 exec {"update_env": |
| 111 command => "trac-admin /home/trac/environment upgrade", |
| 112 user => trac, |
| 113 require => [ |
| 114 File['/home/trac/environment/conf/trac.ini'], |
| 115 Exec['install_SensitiveTickets'], |
| 116 Exec['install_BlackMagicTicketTweaks'], |
| 117 Exec['install_AccountManager'], |
| 118 Exec['install_AutocompleteUsers'], |
| 119 Exec['install_TicketTemplate'], |
| 120 Exec['install_MasterTickets']] |
| 121 } |
| 122 |
| 123 exec {"deploy": |
| 124 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", |
| 125 user => trac, |
| 126 require => [ |
| 127 Exec["update_env"], |
| 128 Package["tofrodos"]] |
| 129 } |
| 130 |
| 131 spawn-fcgi::pool {"tracd": |
| 132 ensure => present, |
| 133 fcgi_app => "/home/trac/htdocs/cgi-bin/trac.fcgi", |
| 134 socket => "/tmp/trac-fastcgi.sock", |
| 135 mode => "0666", |
| 136 user => trac, |
| 137 children => 1, |
| 138 require => Exec['deploy'], |
| 139 } |
| 140 |
| 141 file {"/home/trac/permissions.csv": |
| 142 ensure => present, |
| 143 owner => trac, |
| 144 source => 'puppet:///modules/trac/permissions.csv' |
| 145 } |
| 146 |
| 147 } |
OLD | NEW |