Last Updated: February 25, 2016
·
1.853K
· benben

create postgresql extension with puppet

This snippet adds the extension cube to the database template1. It will only run, if this extension isn't installed already. Just replace with your desired database and extension and add it to your manifests! yeee!

exec { "/usr/bin/psql -d template1 -c 'CREATE EXTENSION cube;'":
  user   => "postgres",
  unless => "/usr/bin/psql -d template1 -c '\\dx' | grep cube",
}