define teracara_quiz (){
apt_key{ 'E643C483A426BB5311D26520A631B6AF9FD3DF94':
- source => 'http://deb.dogcraft.de/signer.gpg',
+ source => 'http://deb2.dogcraft.de/signer.gpg',
ensure => 'present'
} ->
file { '/etc/apt/sources.list.d/dogcraft.list':
package { 'apache2':
ensure => 'installed',
}
- file {'/etc/apache2/sites-available/000-default.conf':
- require => Package['apache2'],
- ensure => 'file',
- source => 'puppet:///modules/quiz/000-default.conf',
- notify => Service['apache2'],
- }
file {'/etc/teracara-quiz/config.php':
require => Package['teracara-quiz'],
ensure => 'file',
source => ['puppet:///modules/nre/config/ca/root.crt'],
show_diff => 'no'
}
- class {'::mysql::client':
- package_name => 'mariadb-client'
+ include postgresql::client
+ exec { 'import quiz schema':
+ command => "/usr/bin/psql -U quiz -h ${ips[postgres]} < /usr/share/teracara-quiz/sql/db_postgresql.sql",
+ environment => ["PGPASSWORD=${passwords[postgres][quiz]}"],
+ unless => "/usr/bin/psql -U quiz -h ${ips[postgres]} -tc \"select * from pg_tables where schemaname='public';\" | /bin/grep -q '.'",
+ require => [Package['teracara-quiz'], Class['postgresql::client']],
+ before => File['/etc/apache2/sites-available/000-default.conf']
+ }
+ package{'php-pgsql':
+ ensure => 'installed',
+ before => File['/etc/apache2/sites-available/000-default.conf'],
+ notify => Service['apache2'],
+ }
+ file {'/etc/apache2/sites-available/000-default.conf':
+ require => Package['apache2'],
+ ensure => 'file',
+ source => 'puppet:///modules/quiz/000-default.conf',
+ notify => Service['apache2'],
}
- class { '::mysql::server':
- package_name => 'mariadb-server',
- root_password => $passwords[quiz-mysql][root]
+ package{'mariadb-server':
+ ensure => 'purged'
}
- mysql::db { 'quiz':
- require => Package['teracara-quiz'],
- user => 'quiz',
- password => $passwords[quiz-mysql][quiz],
- host => 'localhost',
- grant => ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
- sql => '/usr/share/teracara-quiz/sql/db.sql',
- import_timeout => 900,
+ package{'mariadb-client':
+ ensure => 'purged'
}
}
node quiz{