- # cleanup
- postgresql_psql { "DROP PUBLICATION ${pg_db}_publication":
- db => $pg_db,
- onlyif => "SELECT 1 FROM pg_catalog.pg_publication WHERE pubname = '${pg_db}_publication'",
- } ->
- postgresql_replication_slot { $pg_user_replication:
- ensure => absent
- } ->
- postgresql_psql { "DROP OWNED BY $pg_user_replication":
- db => $pg_db,
- onlyif => "SELECT 1 FROM pg_user WHERE usename='$pg_user_replication'"
- } ->
- postgresql::server::role { $pg_user_replication:
- ensure => absent,
- }
- # /cleanup
-