Index: modules/trac/manifests/init.pp |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/modules/trac/manifests/init.pp |
@@ -0,0 +1,137 @@ |
+class trac($domain) inherits private::trac { |
+ package {['python-mysqldb','python-setuptools','subversion']: ensure => present} |
Wladimir Palant
2014/03/03 08:44:31
Style nit: Could you please put |ensure => present
|
+ |
+ include nginx |
+ |
+ nginx::hostconfig {$domain: |
+ content => template('trac/site.erb'), |
+ enabled => true |
+ } |
+ |
+ user {'trac': |
+ ensure => present, |
+ comment => 'User of the trac installation', |
+ home => '/home/trac', |
+ managehome => true |
+ } |
+ |
+ class {'mysql::server': |
+ config_hash => {'root_password' => $database_root_password} |
+ } |
+ |
+ mysql::db {'trac': |
+ user => 'trac', |
+ password => $database_password, |
+ host => 'localhost', |
+ grant => ['all'], |
+ require => Class['mysql::config'] |
+ } |
+ |
+ Exec { |
+ path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', |
+ } |
+ |
+ exec { 'collate': |
+ command => "echo \"ALTER DATABASE trac DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;\" | mysql -u trac -p${database_password}", |
+ require => Mysql::Db['trac'] |
Wladimir Palant
2014/03/03 08:44:31
Please add charset => 'utf8 COLLATE utf8_bin' to t
|
+ } |
+ |
+ exec { 'install_trac': |
+ command => "easy_install Trac==1.0", |
Wladimir Palant
2014/03/03 08:44:31
We might want to use the python-pip package and |p
|
+ require => [ |
+ Package['python-mysqldb', 'python-setuptools'], |
+ Exec['collate']], |
+ unless => "which tracd" |
Wladimir Palant
2014/03/03 08:44:31
We might prefer something like "python -c 'import
|
+ } |
+ |
+ exec { 'trac_env': |
+ command => "trac-admin /home/trac/environment initenv \"Adblock Plus issue tracker\" mysql://trac:${database_password}@localhost:3306/trac", |
+ require => Exec['install_trac'], |
+ user => trac, |
+ onlyif => "test ! -d /home/trac/environment" |
+ } |
+ |
+ |
+ exec { 'install_BlackMagicTicketTweaks': |
+ command => "easy_install http://trac-hacks.org/svn/blackmagictickettweaksplugin/0.12/", |
+ require => [ |
+ Package['subversion'], |
+ Exec['trac_env']] |
Wladimir Palant
2014/03/03 08:44:31
This doesn't really depend on the trac enviroment,
|
+ } |
+ |
+ exec { 'install_SensitiveTickets': |
+ command => "easy_install http://trac-hacks.org/svn/sensitiveticketsplugin/trunk/", |
+ require => [ |
+ Package['subversion'], |
+ Exec['trac_env']] |
+ } |
+ |
+ exec { 'install_AccountManager': |
+ command => "easy_install http://trac-hacks.org/svn/accountmanagerplugin/tags/acct_mgr-0.4.3/", |
+ require => [ |
+ Package['subversion'], |
+ Exec['trac_env']] |
+ } |
+ |
+ |
+ exec { 'install_TicketTemplate': |
+ command => "easy_install http://trac-hacks.org/svn/tractickettemplateplugin/0.11/", |
+ require => [ |
+ Package['subversion'], |
+ Exec['trac_env']] |
+ } |
+ |
+ |
+ exec { 'install_AutocompleteUsers': |
+ command => "easy_install http://trac-hacks.org/svn/autocompleteusersplugin/trunk/", |
+ require => [ |
+ Package['subversion'], |
+ Exec['trac_env']] |
+ } |
+ |
+ file {"/home/trac/environment/conf/trac.ini": |
+ ensure => present, |
+ content => template('trac/trac.ini.erb'), |
+ require => Exec['trac_env'] |
+ } |
+ |
+ file {"/home/trac/environment/htdocs/adblockplus_logo.png": |
+ ensure => present, |
+ source => 'puppet:///modules/trac/adblockplus_logo.png', |
+ require => Exec['trac_env'] |
+ } |
+ |
+ exec {"tracd": |
+ command => "tracd --port 8088 -d -s /home/trac/environment", |
Wladimir Palant
2014/03/03 08:44:31
This needs to run as a service, otherwise it won't
|
+ require => [ |
+ Exec['install_SensitiveTickets'], |
+ Exec['install_BlackMagicTicketTweaks'], |
+ Exec['install_AccountManager'], |
+ Exec['install_AutocompleteUsers'], |
+ Exec['install_TicketTemplate']] |
+ } |
+ |
+ exec {"update_env": |
+ command => "trac-admin /home/trac/environment upgrade", |
Wladimir Palant
2014/03/03 08:44:31
Shouldn't we rather initialize the environment onl
Philip Hill
2014/03/06 14:50:20
As far as I unterstood, installing Plugins require
|
+ require => [ |
+ Exec['install_SensitiveTickets'], |
+ Exec['install_BlackMagicTicketTweaks'], |
+ Exec['install_AccountManager'], |
+ Exec['install_AutocompleteUsers'], |
+ Exec['install_TicketTemplate']] |
+ } |
+ |
+ file {"/home/trac/permissions.csv": |
+ ensure => present, |
+ source => 'puppet:///modules/trac/permissions.csv', |
+ require => Exec['trac_env'] |
+ } |
+ |
+ exec { "set_permission_groups": |
+ command => "trac-admin /home/trac/environment permission import /home/trac/permissions.csv", |
Wladimir Palant
2014/03/03 08:44:31
I don't think that we want to run that every time
|
+ require => [ |
+ Exec['trac_env'], |
+ File['/home/trac/environment/conf/trac.ini']] |
+ } |
+ |
+} |