X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=environments%2Fproduction%2Fmanifests%2Fquiz.pp;h=5d5e3a0804f4fd21da29c4d6ba22d1808b4539b3;hb=3c32a024106395e61b34bdc5064083c65fafec35;hp=70577ff640395c20f5ca0e4f28a755a139ec2004;hpb=e5677f2515f548329c71d158c41d3cf09ddeead8;p=infra.git diff --git a/environments/production/manifests/quiz.pp b/environments/production/manifests/quiz.pp index 70577ff..5d5e3a0 100644 --- a/environments/production/manifests/quiz.pp +++ b/environments/production/manifests/quiz.pp @@ -15,12 +15,6 @@ define teracara_quiz (){ 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', @@ -49,21 +43,25 @@ define teracara_quiz (){ 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'] + } + 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{