test_tablespace.pp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # puppet-postgresql
  2. # For all details and documentation:
  3. # http://github.com/inkling/puppet-postgresql
  4. #
  5. # Copyright 2012- Inkling Systems, Inc.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. class postgresql_tests::system_default::test_tablespace {
  19. include postgresql::server
  20. file { '/tmp/pg_tablespaces':
  21. ensure => 'directory',
  22. owner => 'postgres',
  23. group => 'postgres',
  24. mode => '0700',
  25. }~>
  26. # This works around rubies that lack Selinux support, I'm looking at you RHEL5
  27. exec { "chcon system_u:object_r:postgresql_db_t /tmp/pg_tablespaces":
  28. refreshonly => true,
  29. path => "/bin:/usr/bin",
  30. onlyif => "which chcon",
  31. before => File["/tmp/pg_tablespaces/space1", "/tmp/pg_tablespaces/space2"]
  32. }
  33. postgresql::tablespace{ 'tablespace1':
  34. location => '/tmp/pg_tablespaces/space1',
  35. require => [Class['postgresql::server'], File['/tmp/pg_tablespaces']],
  36. }
  37. postgresql::database{ 'tablespacedb1':
  38. charset => 'utf8',
  39. tablespace => 'tablespace1',
  40. require => Postgresql::Tablespace['tablespace1'],
  41. }
  42. postgresql::db{ 'tablespacedb2':
  43. user => 'dbuser2',
  44. password => 'dbuser2',
  45. tablespace => 'tablespace1',
  46. require => Postgresql::Tablespace['tablespace1'],
  47. }
  48. postgresql::database_user{ 'spcuser':
  49. password_hash => postgresql_password('spcuser', 'spcuser'),
  50. require => Class['postgresql::server'],
  51. }
  52. postgresql::tablespace{ 'tablespace2':
  53. location => '/tmp/pg_tablespaces/space2',
  54. owner => 'spcuser',
  55. require => [Postgresql::Database_user['spcuser'], File['/tmp/pg_tablespaces']],
  56. }
  57. postgresql::database{ 'tablespacedb3':
  58. charset => 'utf8',
  59. tablespace => 'tablespace2',
  60. require => Postgresql::Tablespace['tablespace2'],
  61. }
  62. }