arrow-right

Managing the inside of your Oracle database with Puppet

In this playground we will show you how you can use Puppet to manage the inside of your database.

The playground system

The playground system contains a pre-installed puppet agent. There is no server available, so to run Puppet, you have to use the puppet apply command. The playground text will guide you with this.

On the playground system, you will find an Oracle database with the sid DB01. We have created it using the ora_profile module. The playground will guide you in your customisations.

Working in the playground

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 ora_config module.

Beware

This system will self destruct in about one hour. So please don’t use it to build or create anything you wish to keep!

Subjects in this playground

The playground contains the following sub paragraphs:
  • Using Puppet for introspection
  • Puppet knows about your Oracle profiles too
  • Creating a profile with Puppet from the command line
  • Modifying a profile with Puppet from the command line
Happy exploring!!

Using Puppet for introspection

In this section, we’ll show you how you can use Puppet to introspect your database. In general in Puppet to introspect any resource, you use the command:

$ puppet resource <puppet_type> [<resource_name>]

Looking at your database with puppet

Standard, however Puppet doesn’t know about Oracle and database. The ora_config
module extends puppet, so it now knows about Oracle databases and what is inside of
an Oracle database. First off, we will take a look at using Puppet to introspect the database
itself. We do this by leveraging the Puppet type ora_database

So to see what Puppet knows about your database, enter the next command.

puppet resource ora_database

If you wanted to, you could also use the output of this command as a starting point for a new Puppet manifest.

Puppet knows about your Oracle profiles too

In the last section, we showed you how you could use Puppet to introspect your database. But Puppet can do much more. We will now show you that Puppet can also introspect other database objects. We will demonstrate that now using Oracle profiles.

TEASER: introspection is the prequel to creating and managing Oracle profiles with puppet.

Introspect available Oracle profiles

Remember the general command for introspecting?

puppet resource <puppet_type> [<resource_name>]

For Oracle profiles, the Puppet type is ora_profile. So the command becomes.

puppet resource ora_profile

Just like with databases, the output of this command can be used as a starting pointfor defining new profiles.

Creating a profile with Puppet from the command line

We have been using Puppet from the command line for introspecting. But you can also use puppet on the command line for creating and changing Oracle resources. To do this we again use the puppet resource command.

The general command for making sure a resource exists is:

puppet resource <puppet_type> [<resource_name>] ensure=present

“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 profile with the name MY_TEST_PROFILE.

Create the profile

The command to make this happen is:

puppet resource ora_profile MY_TEST_PROFILE ensure=present

Modifying a profile with Puppet from the command line

The profile MY_TEST_PROFILE exist now, but it has the wrong properties. With the same command as the command to create it, you can also set other properties of the profile.

Setting the password_life_time

The password_life_time of the profile is at its default value. That is not good. We want to be much stricter and set it to 30.

We can use the same puppet resource command and append the change.

puppet resource ora_profile MY_TEST_PROFILE password_life_time=30

You like it?

Do you like what you see here and want to test this on your own infrastructure? No problem. You can sign up for a free trial.

If you have any questions, don’t hesitate to contact us.

waiting
waiting