Simplify your Oracle database setup with Puppet

"Simplify your Oracle database setup with Puppet" Installing and maintaining an Oracle database installation is no small feat. There are a lot of small, moving parts, and it’s easy to overlook things. To help simplify and improve your life, Enterprise Modules has created and maintains Puppet modules that install and maintain Oracle databases so that you don’t have to.

The ora_install module will install an Oracle database, and the ora_profile module can be used to customize your installation. In this blog post, we’ll discuss what you need to do to get these two modules working. Then, in later blog posts, we’ll talk about how you can go about customizing your installation.

The beauty of this approach is that it gives you a quick and easy way to get an Oracle database stood up. You can add Oracle objects just by adding some hiera data. Then, when the default implementation no longer fits your needs, you can override the defaults, including kernel settings and limits.

Getting started

The The ora_install and ora_profile module modules have a number of dependencies to help get things up and running. To install all of these prerequisites, add the following to your Puppetfile:

forge 'https://forge.puppet.com'

mod 'herculesteam-augeasproviders_core', '2.1.4'
mod 'herculesteam-augeasproviders_sysctl', '2.2.0'
mod 'puppet-archive', '3.2.1'
mod 'puppetlabs-concat', '5.2.0'
mod 'stm-debconf', '2.0.0'
mod 'enterprisemodules-easy_type', '2.8.3'
mod 'ipcrm-echo', '0.1.5'
mod 'puppetlabs-firewall'
mod 'crayfishx-firewalld'
mod 'saz-limits', '3.0.2'
mod 'enterprisemodules-ora_cis', '2.0.0'
mod 'enterprisemodules-ora_config', '3.2.2'
mod 'enterprisemodules-ora_install', '4.1.0'
mod 'enterprisemodules-ora_profile', '0.8.0'
mod 'puppetlabs-stdlib', '5.1.0'
mod 'petems-swap_file', '1.0.1'
mod 'saz-timezone', '4.1.1'

Before we can install the database, we need to do some classification work and set a few parameters. To do this, classify your database node with easy_type::license::activate (we’ll talk about this later) and ora_profile::database. Next, set the following parameters:

ora_profile::database::download_dir: '/install'
ora_profile::database::db_definition::sys_password: 'password1!'
ora_profile::database::db_definition::system_password: 'password1!'

Make sure your passwords are at least eight characters with a number or the installation will fail.

The easy_type::license::activate class will activate our Enterprise Modules license, so we need to make sure we have an entitlement file in the right place. Create a module called em_license with the following directory structure:

em-license/
├── files
│   └── <entitlements file>
└── README.md

If you’d like to know more about entitlement files, you can check out our documentation on it.

The ora_install class will look for the database zip files in the software module by default. This is a user configurable setting (ora_install::installdb::puppet_download_mnt_point) and files can be downloaded from NFS, HTTP, Puppet URLs, etc. For now, let’s use the software module, so let’s go ahead and make it with the following directory structure:


software/
├── files
│   ├── linuxx64_12201_database.zip
│   ├── p27468969_122010_Linux-x86-64.zip
│   └── p6880880_122010_Linux-x86-64.zip
└── README.md

Now that we have those two modules in place, let’s add them to our Puppetfile:

mod 'em_license',
  :git    => '<location>',
  :branch => 'master'

mod 'software',
  :local => true

Because the software module is quite big, it is better to copy it once to your Puppet server and let r10k manage it as a local module.

Installing an Oracle database

With that done, we can now run Puppet on our Oracle node to install the database. It’s that easy.

To validate that the database is installed, login as the oracle user. You’ll need to source your Oracle environment:

. oraenv

Set ORACLE_SID to DB01 and, if prompted, ORACLE_HOME to /u01/app/oracle.

Then, run /u01/app/oracle/product/12.2.0.1/db_home1/bin/sqlplus / as sysdba and you’re in your brand-new, managed Oracle database.

What now?

Now that you have your database installed, you can start creating Oracle users, tablespaces, and other fun stuff. To learn more, read through the ora_profile documentation and hang tight for our next blog post where we cover basic customizations.

Comments