Powered By Blogger

2016/06/28

Let us play with some puppet Modules - Part I: Puppetizing Oracle Database Server Installation with biemond/oradb

In the series of "Let us play with some puppet Modules" posts, I'm willing to share my experience related to the usage of some Forge Puppet Modules. To make it more understandable, I'm trying to make use of a set of well-known Puppet's best practice, with a great emphasis on the following (Check the reference section for Websites where you can learn more about Puppet's best practice):
  • Roles and Profiles Pattern
  • Hiera for Configuration Data
The posts in this series are all following the below structure:

  1. Module Installation and others prerequisites
  2. Profile Module creation
  3. Hiera Configuration
  4. Roles Configuration
  5. Puppet Agent Single run

This post is the first within that "Let us play with some puppet Modules" series and it aims to describe a simple Oracle Database Software Installation using biemond/oracle Module.

   I. Module Installation and others prerequisites:

The installation of the module is quite easy,

[root@pe-master ~] # puppet module install biemond-oradb


As for the prerequisites, there's a need to make Installation files available either as a zipped Installation files or providing a mountpoint. For this post, I downloaded the Oracle Database Server Installation files and unzipped everything under an  NFS Share which is auto-mounted when needed (note that you can also have files with partx_of_y.zip).


[root@pe-master ~]# ls /net/nfs-server/Archives/INFRASTRUCTURE/dba_softs/11.2.0.3/
linux_86_64  solaris  windows

   II. Profile Module Creation:

Let us create a specific Profile for Oracle Server Technology, note that I'm using a parameterized class for that profile, with no default value for the parameters. Meaning that, these parameters must absolutely be set to use this profile.


class profiles::oracle_server (
 $version,
 $zip_extract                             = false,
 $remote_file                             = false,
 $database_type,
 $oracle_base,
 $oracle_home,
 $user,
 $group,
 $group_install,
 $group_oper,
 $download_dir,
 $bash_profile,
 $oracle_rdbms_server_preinstall_package,
)
{

  package { $oracle_rdbms_server_preinstall_package:
    ensure => present,
  }

  oradb::installdb{ "${version}_${::kernel}-${::architecture}":
    version                   => $version,
    zip_extract               => $zip_extract,
    remote_file               => $remote_file,
    database_type             => $database_type,
    oracle_base               => $oracle_base,
    oracle_home               => $oracle_home,
    user                      => $user,
    group                     => $group,
    group_install             => $group_install,
    group_oper                => $group_oper,
    download_dir              => $download_dir,
    bash_profile              => $bash_profile,
    require                   => Package[$oracle_rdbms_server_preinstall_package],
  }

}


Few words about the parameters I used (there are obviously more available parameters):


  • version:  String to give The database version to install ('12.1.0.2','11.2.0.3','11.2.0.4')
  • zip_extract: Boolean to determine Whether to use ZIP files or to use a pre-extracted directory structure for Database Installation File
  • remote_file: Boolean to determine whether or not to use Installation file remotely
  • database_type: Should be EE (Enterprise Edition), SE (Standard Edition) or SEONE (Standard Edition One)
  • oracle_base:  Oracle Base Directory
  • oracle_home:  Oracle Home Directory
  • user: Oracle User
  • group: Oracle User Group
  • group_install: Group Install
  • group_oper: Group Oper
  • download_dir: Local Folder where the Installation files are located (zipped or unzipped, depending on zip_extract)
  • bash_profile: Boolean to determine whether or not to populate the bash_profile based on a template
  • oracle_rdbms_server_preinstall_package: The Oracle Preinstallation RPM package installs software packages and sets system parameters required for Oracle Database single instance and Oracle  Real Application Clusters installations for Oracle Linux



   III. Hiera Configuration:

As said during the brief introduction above, I'm exclusively using Hiera to store Nodes' configuration data. Below, the Hiera configuration for the set of nodes where I'm installing the Database Software.

---
profiles::oracle_server::version:                                '11.2.0.1'
profiles::oracle_server::file:                                   'linux.x64_11gR2_database'
profiles::oracle_server::database_type:                          'EE'
profiles::oracle_server::oracle_base:                            '/opt/OBIEE/oracle'
profiles::oracle_server::oracle_home:                            '/opt/OBIEE/oracle/product/11.2/db'
profiles::oracle_server::user:                                   'oracle'
profiles::oracle_server::group:                                  'oinstall'
profiles::oracle_server::group_install:                          'oinstall'
profiles::oracle_server::group_oper:                             'oinstall'
profiles::oracle_server::download_dir:                           '/opt/OBIEE/oracle/install'
profiles::oracle_server::bash_profile:                           true
profiles::oracle_server::remote_file:                            false
profiles::oracle_server::puppet_download_mnt_point:              "/net/nfs-server/Archives/INFRASTRUCTURE/dba_softs/zip"
profiles::oracle_server::logoutput:                              true
profiles::oracle_server::oracle_rdbms_server_preinstall_package: 'oracle-rdbms-server-11gR2-preinstall'



   IV. Roles Configuration:

Using the Oracle profile described in Section II, with the right Hiera Data, we can move forward with the roles modules configuration,

class roles::dbserver  {
 
    # Install Oracle Server
    include profiles::oracle_server

}


   IV. Puppet Agent Single run:


And finally, let us trigger a puppet convergence and enjoy the output...


[root@oracle-srv OBIEE]# puppet agent -t
Warning: Local environment: "production" doesn't match server specified node environment "dev", switching agent to "dev".
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Warning: Creating db_directory_structure via Puppet.newtype is deprecated and will be removed in a future release. Use Puppet::Type.newtype instead.
   (at /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:145:in `newtype')
Info: Caching catalog for oracle-srv.mtncameroon.net
Info: Applying configuration version '1463725878'
Notice: oradb::installdb /opt/OBIEE/oracle/product/11.2/db does not exists
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Notify[oradb::installdb /opt/OBIEE/oracle/product/11.2/db does not exists]/message: defined 'message' as 'oradb::installdb /opt/OBIEE/oracle/product/11.2/db does not exists'
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[extract /opt/OBIEE/oracle/install/linux.x64_11gR2_database_1of2.zip]/returns: executed successfully
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[extract /opt/OBIEE/oracle/install/linux.x64_11gR2_database_2of2.zip]/returns: executed successfully
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/File[/opt/OBIEE/oracle/install/db_install_11.2.0.1.rsp]/content: 
--- /opt/OBIEE/oracle/install/db_install_11.2.0.1.rsp   2016-05-20 07:21:20.045331674 +0100
+++ /tmp/puppet-file20160520-25536-bwmflf       2016-05-20 07:31:52.099071875 +0100
@@ -146,7 +146,7 @@
 #------------------------------------------------------------------------------
 # The OPER_GROUP is the OS group which is to be granted OSOPER privileges.
 #------------------------------------------------------------------------------
-oracle.install.db.OPER_GROUP=oper
+oracle.install.db.OPER_GROUP=oinstall
 
 #------------------------------------------------------------------------------
 # Specify the cluster node names selected during the installation.

Info: Computing checksum on file /opt/OBIEE/oracle/install/db_install_11.2.0.1.rsp
Info: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/File[/opt/OBIEE/oracle/install/db_install_11.2.0.1.rsp]: Filebucketed /opt/OBIEE/oracle/install/db_install_11.2.0.1.rsp to main with sum 931ae2da0edc3524ba958c5ce5ae574b
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/File[/opt/OBIEE/oracle/install/db_install_11.2.0.1.rsp]/content: content changed '{md5}931ae2da0edc3524ba958c5ce5ae574b' to '{md5}664e0813045707a7cb86c9eb02df2f96'
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: Starting Oracle Universal Installer...
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: 
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: Checking Temp space: must be greater than 120 MB.   Actual 16795 MB    Passed
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: Checking swap space: must be greater than 150 MB.   Actual 9999 MB    Passed
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-05-20_07-31-58AM. Please wait ...You can find the log of this install session at:
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns:  /opt/OBIEE/oraInventory/logs/installActions2016-05-20_07-31-58AM.log
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: The following configuration scripts need to be executed as the "root" user. 
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns:  #!/bin/sh 
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns:  #Root scripts to run
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: 
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: /opt/OBIEE/oracle/product/11.2/db/root.sh
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: To execute the configuration scripts:
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns:    1. Open a terminal window 
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns:    2. Log in as "root" 
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns:    3. Run the scripts 
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns:    4. Return to this window and hit "Enter" key to continue 
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: 
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: Successfully Setup Software.
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[install oracle database 11.2.0.1_Linux-x86_64]/returns: executed successfully
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[run root.sh script 11.2.0.1_Linux-x86_64]/returns: Check /opt/OBIEE/oracle/product/11.2/db/install/root_oracle-srv.mtncameroon.net_2016-05-20_07-34-46.log for the output of root script
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[run root.sh script 11.2.0.1_Linux-x86_64]/returns: executed successfully
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/File[/opt/OBIEE/oracle/product/11.2/db]/mode: mode changed '0755' to '0775'
Notice: /Stage[main]/Profiles::Oracle_server/Oradb::Installdb[11.2.0.1_Linux-x86_64]/Exec[remove oracle db extract folder 11.2.0.1_Linux-x86_64]/returns: executed successfully
Notice: Applied catalog in 233.53 seconds


Done, Oracle Database Installation Puppetised!

References:
http://www.cakesolutions.net/teamblogs/puppet-and-friends 


3 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Can you please let me know the hiera.yaml contents ?

    ReplyDelete
  3. Since i am very new to puppet where do i need to create profile oracle_server and dbserver

    ReplyDelete