diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-08-22 21:43:38 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-08-22 21:43:38 -0400 |
commit | cf7a443447c39da67f788b670c2e37f76e67df9c (patch) | |
tree | a82520e3ff5c31a60f973782c29f5e48580eeb40 | |
parent | b729baf86deca6d69797bc42cf93f303eee9baa1 (diff) | |
download | puppet-tozt-cf7a443447c39da67f788b670c2e37f76e67df9c.tar.gz puppet-tozt-cf7a443447c39da67f788b670c2e37f76e67df9c.zip |
ensure postgres permissions are correct
-rw-r--r-- | modules/postgres/manifests/init.pp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/postgres/manifests/init.pp b/modules/postgres/manifests/init.pp index 3ac9887..890c81a 100644 --- a/modules/postgres/manifests/init.pp +++ b/modules/postgres/manifests/init.pp @@ -4,7 +4,8 @@ class postgres { $dbpath = "${persistent_data}/postgres" # lint:ignore:variable_scope package { "postgresql": - ensure => installed; + ensure => installed, + notify => Exec["fixup db path permissions"]; } file { @@ -29,6 +30,16 @@ class postgres { require => File["/etc/systemd/system/postgresql.service.d"]; } + exec { "fixup db path permissions": + command => "chown -R postgres:postgres ${dbpath}", + refreshonly => true, + require => [ + Package['postgresql'], + File[$dbpath], + ], + before => Service['postgresql']; + } + exec { "initialize db path": command => "/usr/bin/initdb -D $dbpath/data", user => 'postgres', |