Puppet module for Subunit2sql
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

server.pp 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Copyright 2012-2013 Hewlett-Packard Development Company, L.P.
  2. # Copyright 2013 OpenStack Foundation
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  5. # not use this file except in compliance with the License. You may obtain
  6. # a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. # License for the specific language governing permissions and limitations
  14. # under the License.
  15. # == Class: subunit2sql
  16. #
  17. class subunit2sql::server (
  18. $db_dialect = 'mysql',
  19. $db_user = 'subunit2sql',
  20. $db_pass,
  21. $db_host,
  22. $db_port = '3306',
  23. $db_name = 'subunit2sql',
  24. $expire_age = '186',
  25. $expire_cron_minute = '0',
  26. $expire_cron_hour = '3',
  27. $expire_cron_weekday = '7',
  28. ) {
  29. file { '/etc/subunit2sql.conf':
  30. ensure => present,
  31. owner => 'root',
  32. group => 'root',
  33. mode => '0555',
  34. content => template('subunit2sql/subunit2sql.conf.erb'),
  35. }
  36. file {'/etc/subunit2sql-my.cnf':
  37. ensure => present,
  38. owner => 'root',
  39. group => 'root',
  40. mode => '0400',
  41. content => template('subunit2sql/subunit2sql-my.cnf.erb'),
  42. }
  43. file {'/usr/local/bin/run_migrations.sh':
  44. ensure => present,
  45. owner => 'root',
  46. group => 'root',
  47. mode => '0555',
  48. source => 'puppet:///modules/subunit2sql/run_migrations.sh',
  49. require => File['/etc/subunit2sql.conf']
  50. }
  51. exec { 'upgrade_subunit2sql_db':
  52. command => '/usr/local/bin/run_migrations.sh',
  53. require => File['/usr/local/bin/run_migrations.sh'],
  54. subscribe => Package['subunit2sql'],
  55. refreshonly => true,
  56. timeout => 0,
  57. }
  58. cron { 'subunit2sql-prune':
  59. ensure => present,
  60. command => "subunit2sql-db-manage --config-file /etc/subunit2sql.conf expire --expire-age ${expire_age} >> /var/log/subunit2sql_migration.log 2>&1 & ",
  61. minute => $expire_cron_minute,
  62. hour => $expire_cron_hour,
  63. weekday => $expire_cron_weekday,
  64. environment => 'PATH=/usr/local/bin:/usr/bin:/bin/',
  65. }
  66. }