arrow-right

Installing WebLogic and creating your domain with Puppet

In this playground, we will show you how easy it is to install WebLogic software using Puppet. You will see that Puppet cannot only take care of the WebLogic software installation itself but also take care of all prerequisites.

After Puppet executed the prerequisites and WebLogic installation, we will show you that Puppet also can create the domain.

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.

This system is what we call a “stem-cell” system. At this point in time, it is not predestined to become an WebLogic server. In fact, it could just as easily become a WebLogic server. All of the steps needed to make this stem-cell system become an WebLogic server are performed by Puppet.

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 wls_profile 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:
  • Puppet code for WebLogic installation
  • Ensure prerequisites
  • Install the WebLogic software
  • Create the domain
Happy exploring!!

Puppet code for WebLogic installation

We have done our best to make it as easy as possible to use Puppet to change your “stem-cell” system into a running WebLogic admin server. Let’s look at some of the Puppet code needed to do this.

In the editor tab, go to the directory hierdata\nodes and open the file wls01.playground.enterprisemodules.com.yaml. This file contains all the node-specific data.

At the top, you see:

role: role::wls::admin_server

This hiera definition tells Puppet that for this node, node wls01.enterprisemodules.com, we want to apply the Puppet class role::wls::admin_server.

The role role: role::wls::admin_server

Let’s see what this Puppet class is doing for us. In the editor tab, go to the directory modules\role\manifests\wls and open the file admin_server.pp. For your convenience, I have included the contents here as well.

# Install java, WebLogic and create the domain.
class role::wls::admin_server()
{
  contain ::profile::base
  contain ::wls_profile::admin_server

  Class['::profile::base'] -> Class['::wls_profile::admin_server']

}

As you can see, this role class contains two other classes (contain is a special sort of include). The ::profile::base class is what we call: the base profile. A base profile contains all Puppet definitions you would like to apply to every node in your organization. It includes all standard settings you want to apply to your system, no matter what.

The second include is the ::wls_profile::admin_server class. This Puppet class is where all the magic happens! It transforms this node into WebLogic admin server.

Pretty easy, right? Now, Let’s see it in action!

Ensure prerequisites

In a normal situation, the wls_profile Puppet class would silently take care of all your prerequisites. For teaching purposes, however, we have disabled this.

In the editor tab, go to the directory hierdata\nodes and open the file wls01.playground.enterprisemodules.com.yaml. This file contains all the node-specific data.

In tis file you see this:

wls_profile::weblogic::sysctl:           skip
wls_profile::weblogic::limits:           skip
wls_profile::weblogic::packages:         skip
wls_profile::weblogic::groups_and_users: skip
wls_profile::weblogic::ssh_setup:        skip
wls_profile::weblogic::firewall:         skip
wls_profile::weblogic::java_software:    skip
wls_profile::weblogic::wls_software:     skip

These are the hiera settings that tell wls_profile NOT to execute the steps involving: limits, groups_and_users, etc. (as explained in the first paragraph).

First Puppet run

First Puppet run

With all the skips in place, let’s run Puppet and see what happens. Jump back to the terminal tab en execute the command below:

puppet apply site.pp 

Well, that didn’t do a lot. It installed a package and copied some files.

Notice: Compiled catalog for ora19.playground.enterprisemodules.com in environment production in 0.26 seconds
Notice: /Stage[setup]/Easy_type::License::Available/File[/etc/puppetlabs/puppet/em_license]/ensure: created
Notice: /Stage[setup]/Easy_type::License::Available/File[/etc/puppetlabs/puppet/em_license/.gitkeep]/ensure: defined content as '{md5}d41d8cd98f00b204e9800998ecf8427e'
Notice: /Stage[main]/Profile::Base::Docker/Package[mlocate]/ensure: created
Notice: Applied catalog in 8.80 seconds

What it actually did, was executing only the base profile. The base profile for this tutorial is kept very minimal for obvious reasons.

Re-enable all prerequisite steps.

In this next step, we are going to enable some of the skipped definitions in the hierarchy configuration. To do this, open the node yaml again (in the editor tab). Navigate to the first block (lines 11 to 16) of skips and remove or comment out all lines except the wls_software one (line 16). No need to save the file, we’ll do that for you in the background.

# wls_profile::weblogic::sysctl:           skip
# wls_profile::weblogic::limits:           skip
# wls_profile::weblogic::packages:         skip
# wls_profile::weblogic::groups_and_users: skip
# wls_profile::weblogic::ssh_setup:        skip
# wls_profile::weblogic::firewall:         skip
# wls_profile::weblogic::java_software:    skip
wls_profile::weblogic::wls_software:     skip
#

Re-run Puppet

So, now wls_profile will execute more of its regular steps. Let’s see what a re-run of Puppet provides us.xs

puppet apply site.pp 
Notice: Scope(Java::Download[jdk-8u231-linux-x64.tar.gz]): Destination is /tmp/jdk-8u231-linux-x64.tar.gz
Notice: Compiled catalog for wls01.playground.enterprisemodules.com in environment production in 0.72 seconds
Notice: Setting up ssh keys for oracle
Notice: Java version 8u231
Notice: Ensure Limit(s) for wls_profile::weblogic::limits: */nofile
Notice: Ensure Package(s) for wls_profile::weblogic::packages: binutils.x86_64,net-tools
Notice: Ensure Group(s) dba
Notice: Ensure User(s) oracle
Notice: /Stage[main]/Limits/File[/etc/security/limits.d/20-nproc.conf]/ensure: removed
Notice: /Stage[main]/Wls_profile::Weblogic::Limits/Easy_type::Profile::Limits[wls_profile::weblogic::limits]/Limits::Limits[*/nofile]/File[/etc/security/limits.d/default_nofile.conf]/ensure: defined content as '{md5}f7cbd10a8def43f7954ebcbe788226cf'
Notice: /Stage[main]/Wls_profile::Weblogic::Packages/Easy_type::Profile::Packages[wls_profile::weblogic::packages]/Package[net-tools]/ensure: created
Notice: /Stage[main]/Wls_profile::Weblogic::Groups_and_users/Easy_type::Profile::Groups_and_users[wls_profile::weblogic::groups_and_users]/Group[dba]/ensure: created
Notice: /Stage[main]/Wls_profile::Weblogic::Groups_and_users/Easy_type::Profile::Groups_and_users[wls_profile::weblogic::groups_and_users]/User[oracle]/ensure: created
Notice: /Stage[main]/Wls_profile::Weblogic::Ssh_setup/File[/home/oracle/.ssh]/ensure: created
Notice: /Stage[main]/Wls_profile::Weblogic::Ssh_setup/File[/home/oracle/.ssh/id_rsa]/ensure: defined content as '{md5}f8e965190a30ffea399e160fae0dc127'
Notice: /Stage[main]/Wls_profile::Weblogic::Ssh_setup/Ssh_authorized_key[oracle]/ensure: created
Notice: /Stage[main]/Wls_profile::Weblogic::Java_software/Java::Download[jdk-8u231-linux-x64.tar.gz]/Package[unzip]/ensure: created
Notice: /Stage[main]/Wls_profile::Weblogic::Java_software/Java::Download[jdk-8u231-linux-x64.tar.gz]/Archive[/tmp/jdk-8u231-linux-x64.tar.gz]/ensure: download archive from http://em-repo/software/jdk-8u231-linux-x64.tar.gz to /tmp/jdk-8u231-linux-x64.tar.gz  without cleanup
Notice: /Stage[main]/Wls_profile::Weblogic::Java_software/Java::Download[jdk-8u231-linux-x64.tar.gz]/File[/usr/java]/ensure: created
Notice: /Stage[main]/Wls_profile::Weblogic::Java_software/Java::Download[jdk-8u231-linux-x64.tar.gz]/Exec[Install Oracle java_se jdk 8 8u231 ]/returns: executed successfully
Notice: /Stage[main]/Wls_profile::Weblogic::Java_software/Java::Download[jdk-8u231-linux-x64.tar.gz]/Archive[/tmp/jce-8.zip]/ensure: download archive from http://em-repo/software/jce_policy-8.zip to /tmp/jce-8.zip and extracted in /usr/java/jdk1.8.0_231/jre/lib/security without cleanup
Notice: /Stage[main]/Wls_profile::Weblogic::Java_software/File[/usr/bin/java]/ensure: created
Notice: /Stage[main]/Wls_profile::Weblogic::Java_software/Exec[set urandom jdk1.8.0_231]/returns: executed successfully
Notice: /Stage[main]/Wls_profile::Weblogic::Java_software/Exec[sleep 3 sec for urandomJavaFix jdk1.8.0_231]/returns: executed successfully
Notice: /Stage[main]/Wls_profile::Weblogic::Java_software/Exec[set RSA keySize jdk1.8.0_231]: Triggered 'refresh' from 1 event
Notice: Applied catalog in 11.60 seconds

Wow, that’s a lot more. What Puppet does now is:

  • Configuring all sysctl settings
  • Configuring all security limits
  • Installing required packages
  • Creating the required wls users and groups
  • Setting up ssh
  • Setting up firewall
  • Installing java

And with that, all needed prerequisites for a successful WebLogic admin server installation are fulfilled.

Next up: installing the WebLogic software itself.

Install the WebLogic software

With all of the prerequisites done, it is time to install some WebLogic software.

In the editor tab, go to the directory hierdata\nodes and open the file wls01.playground.enterprisemodules.com.yaml. This file contains all the node-specific data.

Let’s comment out the skip for the step wls_profile::weblogic::wls_software as well now (line 16). Meaning: next Puppet run, DO execute the software installation.
Your hiera should look something like this now:

#
# wls_profile::weblogic::sysctl:           skip
# wls_profile::weblogic::limits:           skip
# wls_profile::weblogic::packages:         skip
# wls_profile::weblogic::groups_and_users: skip
# wls_profile::weblogic::ssh_setup:        skip
# wls_profile::weblogic::firewall:         skip
# wls_profile::weblogic::java_software:    skip
# wls_profile::weblogic::wls_software:     skip
#

Re-run Puppet

Let’s see what Puppet has got in store for us now and re-run Puppet.

puppet apply site.pp 

Be aware: installing the WebLogic software can take some time. On average a Puppet run will take two to four minutes.

So, now wls_profile will execute all of the steps required to install the WebLogic software. Since it has already taken care of the prerequisites in the previous Puppet run, it will detect everything is already in place and report no additional changes on this.

For the actual WebLogic software installation, it executes these steps:
1) Create all required directories
2) Fetch the Weblogic software zip from a file server and unzip it.
3) Run the weblogic installed
4) Cleanup

Re-run Puppet and check idempotency

What happens now if we run Puppet again?

puppet apply site.pp 

Puppet detects everything is in its desired state (configured as described in your Puppet manifests and hierarchy settings) and changes nothing. It is idempotent.

Next up: Create a domain.

Create the domain

Last, but certainly not least, we will have to ensure the WebLogic domain is available to the users.

In the editor tab, go to the directory hierdata\nodes and open the file ora19.playground.enterprisemodules.com.yaml. This file contains all the node-specific data.

If you take a look at the third block of settings (lines 28 through 35), they should like this for now:

wls_profile::basic_domain::wls_domain:           skip
wls_profile::basic_domain::wls_startup:          skip
wls_profile::admin_server::wls_servers:          skip
wls_profile::admin_server::wls_cluster:          skip
wls_profile::admin_server::wls_datasources:      skip
wls_profile::admin_server::wls_jms:              skip
wls_profile::admin_server::wls_users_and_groups: skip
wls_profile::admin_server::pack_domain:          skip

This tell’s Puppet to skip all these WebLogic steps. Like I explained before, this is here for teaching purposes. Let’s remove or comment out all of these skips, so Puppet will apply a full manifest that ensures the creation of the WebLogic domain and other WebLogic objects.

Make sure yaml file now looks like this:

# wls_profile::basic_domain::wls_domain:           skip
# wls_profile::basic_domain::wls_startup:          skip
# wls_profile::admin_server::wls_servers:          skip
# wls_profile::admin_server::wls_cluster:          skip
# wls_profile::admin_server::wls_datasources:      skip
# wls_profile::admin_server::wls_jms:              skip
# wls_profile::admin_server::wls_users_and_groups: skip
# wls_profile::admin_server::pack_domain:          skip
#

Re-run Puppet

Let’s see what Puppet has in store for us now, as we re-run Puppet via the terminal window:

puppet apply site.pp 
Notice: Scope(Java::Download[jdk-8u231-linux-x64.tar.gz]): Destination is /tmp/jdk-8u231-linux-x64.tar.gz
Notice: Compiled catalog for wls01.playground.enterprisemodules.com in environment production in 2.00 seconds
Notice: Setting up ssh keys for oracle
Notice: Java version 8u231
Notice: WebLogic Software 12214 into /opt/oracle/middleware12 using java in /usr/java/jdk1.8.0_231.
Notice: WebLogic domain for domain MYDOMAIN using template for standard
Notice: WebLogic servers 
Notice: WebLogic cluster main with servers 
Notice: WebLogic Datasources  
Notice: WebLogic JMS configuration
Notice: WebLogic Groups and Users
Notice: Ensure Limit(s) for wls_profile::weblogic::limits: */nofile
Notice: Ensure Package(s) for wls_profile::weblogic::packages: binutils.x86_64,net-tools
Notice: Ensure Group(s) dba
Notice: Ensure User(s) oracle
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/Exec[create /opt/oracle/domains/log directory]/returns: executed successfully
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/File[/var/install/utils.py]/ensure: defined content as '{md5}c517a4048d58eee7692e64893065d5c3'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/File[domain.py MYDOMAIN MYDOMAIN]/ensure: defined content as '{md5}4ea176aa1f673662d68c85fbe0c6515d'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/File[/opt/oracle/domains]/owner: owner changed 'root' to 'oracle'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/File[/opt/oracle/domains]/group: group changed 'root' to 'dba'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/File[/opt/oracle/domains]/mode: mode changed '0755' to '0775'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/File[/opt/oracle/domains/log]/owner: owner changed 'root' to 'oracle'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/File[/opt/oracle/domains/log]/group: group changed 'root' to 'dba'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/File[/opt/oracle/domains/log]/mode: mode changed '0755' to '0775'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/Exec[execwlst MYDOMAIN MYDOMAIN]/returns: executed successfully
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/File[/opt/oracle/domains/applications]/ensure: created
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/File[/etc/wls_domains.dat]/ensure: created
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/File_line[domain entry for MYDOMAIN]/ensure: created
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Domain[MYDOMAIN]/Exec[domain.py MYDOMAIN MYDOMAIN]/returns: executed successfully
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Nodemanager[nodemanager for MYDOMAIN]/File[nodemanager.properties ux 12214 nodemanager for MYDOMAIN]/ensure: defined content as '{md5}ef05acb9b872aad513ba34db0664957c'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Nodemanager[nodemanager for MYDOMAIN]/Exec[startNodemanager nodemanager for MYDOMAIN]/returns: executed successfully
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Nodemanager[nodemanager for MYDOMAIN]/Exec[restart NodeManager nodemanager for MYDOMAIN]: Triggered 'refresh' from 1 event
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Nodemanager[nodemanager for MYDOMAIN]/Sleep[wake up nodemanager for MYDOMAIN]: Triggered 'refresh' from 2 events
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_install::Control[start_adminserver_MYDOMAIN]/Wls_adminserver[start_adminserver_MYDOMAIN:AdminServer]/ensure: ensure changed 'stop' to 'start'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_setting[MYDOMAIN]/user: defined 'user' as 'oracle'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_setting[MYDOMAIN]/weblogic_home_dir: defined 'weblogic_home_dir' as '/opt/oracle/middleware12/wlserver'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_setting[MYDOMAIN]/weblogic_user: defined 'weblogic_user' as 'weblogic'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_setting[MYDOMAIN]/connect_url: defined 'connect_url' as 't3://localhost.localdomain:7001'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_setting[MYDOMAIN]/weblogic_password: changed [redacted] to [redacted]
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_setting[MYDOMAIN]/debug_module: defined 'debug_module' as 'false'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_setting[MYDOMAIN]/archive_path: defined 'archive_path' as '/tmp/wls_config-archive'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_setting[MYDOMAIN]/custom_trust: defined 'custom_trust' as 'false'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_server[MYDOMAIN/AdminServer]/logfilename: logfilename changed '/opt/oracle/domains/log/AdminServer.log' to '/opt/oracle/domains/log/AdminServer/AdminServer_MYDOMAIN.log'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_server[MYDOMAIN/AdminServer]/log_file_min_size: log_file_min_size changed 5000 to 2000
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_server[MYDOMAIN/AdminServer]/log_datasource_filename: log_datasource_filename changed 'logs/datasource.log' to '/opt/oracle/domains/log/AdminServer/datasource.log'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_server[MYDOMAIN/AdminServer]/log_http_filename: log_http_filename changed 'logs/access.log' to '/opt/oracle/domains/log/AdminServer/access.log'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_server[MYDOMAIN/AdminServer]/server_parameters: defined 'server_parameters' as 'None'
Notice: /Stage[main]/Wls_profile::Basic_domain::Wls_domain/Wls_adminserver[MYDOMAIN/AdminServer]: Triggered 'refresh' from 6 events
Notice: /Stage[main]/Wls_profile::Admin_server::Wls_cluster/Wls_cluster[MYDOMAIN/main]/ensure: created
Notice: Applied catalog in 227.75 seconds
[root@wls01 manifests]# 

Be aware that creating a WebLogic server, in general, is a time-consuming job (with our without Puppet) and is a test of your patience. In this playground, a Puppet run might take up to 4 minutes to complete, ensuring the domain is ready.

After this Puppet run, you’ll see that domain MYDOMAIN has been created and runs on your playground system.

Re-run Puppet and check idempotency

And again, let’s see what happens if we run Puppet one last time:

puppet apply site.pp 

Puppet detects everything is at its desired state, as described in your Puppet manifests and hierarchy settings. No changes will be made to the system—another example of the built-in idempotency.

Next up: Customising your WebLogic domain

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