Index: modules/trac/manifests/init.pp |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/modules/trac/manifests/init.pp |
@@ -0,0 +1,128 @@ |
+class trac($domain) inherits private::trac { |
+ package {['python-mysqldb','python-setuptools','subversion']: 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'] |
+ } |
+ |
+ exec { 'install_trac': |
+ command => "easy_install Trac==1.0", |
+ require => [ |
+ Package['python-mysqldb', 'python-setuptools'], |
+ Exec['collate']], |
+ unless => "which tracd" |
+ } |
+ |
+ 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']] |
+ } |
+ |
+ 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", |
+ require => [ |
+ Exec['install_BlackMagicTicketTweaks'], |
+ Exec['install_AccountManager'], |
+ Exec['install_AutocompleteUsers'], |
+ Exec['install_TicketTemplate']] |
+ } |
+ |
+ exec {"update_env": |
+ command => "trac-admin /home/trac/environment upgrade", |
+ require => [ |
+ 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", |
+ require => [ |
+ Exec['trac_env'], |
+ File['/home/trac/environment/conf/trac.ini']] |
+ } |
+ |
+} |