
In this playground, we will show you how you can use Puppet to manage your Postgres database setup.
On the playground system, you will find an Postgres database. We have created it using the pg_profile
module. The playground will guide you in your customisations.
Under this text, you see the working area. You can inspect the system and issue any command you like in the terminal. In the editor window, you can see the Puppet production environment. You can edit anything you wish. The documentation tab shows the documentation for the pg_config
module.
This system will self destruct in about one hour. So please don’t use it to build or create anything you wish to keep!
Using Puppet for introspectionIn this section, we’ll show you how you can use Puppet to introspect your Postgres server. In general in Puppet to introspect any resource, you use the command:
Looking at your Postgres database with puppetStandard, however, Puppet doesn’t know about Postgres database. There is a set of So to see what types are provided to manage your databases, enter the next command.
The command will list all the types existing in puppet resource and filters the output for those starting with Puppet knows about your Postgres databases tooIn the last section, we showed you what types are provided in our Puppet modules to introspect your databases. In this section, we will get a close look at the TEASER: introspection is the prequel to creating and managing Postgres databases with the Puppet. Introspect available Postgres databasesRemember the general command for introspecting?
For Postgres databases the Puppet type is
The output of this command can be used as a starting point for defining new Postgres databases. Creating a database with Puppet from the command lineWe have been using Puppet from the command line for introspecting. But you can also use puppet on the command line for creating and changing Postgres resources. To do this we again use the The general command for making sure a resource exists is:
“Making sure a resource exists” means that when it doesn’t exist, Puppet will create it for us. Let’s use this to create a new database with the name Create the Postgres databaseThe command to make this happen is:
Now check the output:
If we do the command again, notice that we don’t get the message Modifying a Postgres database with Puppet from the command lineThe database Setting the
|
![]() ![]() |