Inspecting WebLogic with Puppet

Published on: Category: Oracle

I recently discussed Puppet with some colleagues and the added value it adds to infrastructure-related issues. The reason we focused on Puppet was because of the superb WebLogic and Oracle database support that exists for it. There are modules for WebLogic in Chef, but these only install the software. With Puppet, you can manage much more.

Many blogs that mention Puppet tend to focus on how you can provision the software. In almost all of my customer cases, WebLogic is already responsible for serving applications like SOA Suite, ADF or bespoke Java applications. Surely we should be able to show the power of Puppet for existing systems as well!

In this blog, I’ll discuss the Oracle SOA Suite 12.1.3 box, which you can download here. All I had to do was start SOA Suite using the desktop shortcuts.

Step 1: install Puppet

Installing Puppet on RHEL was easy. I only needed to import the Yum repository used by Puppet – the company – to serve the RPM and then install the Puppet agent. In the SOA Suite Box, a proxy was active, which prevented me from connecting.  

  1. [oracle@soa-training ~]$ yum search puppet
  2. Loaded plugins: refresh-packagekit, ulninfo
  3. http://public-yum.oracle.com/repo/OracleLinux/OL6/UEK/latest/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 5 - "Couldn't resolve proxy 'www-proxy.us.oracle.com'"
  4. Trying other mirror.
  5. Error: Cannot retrieve repository metadata (repomd.xml) for repository: public_ol6_UEK_latest. Please verify its path and try again

The solution to this problem was to open /etc/yum.conf and comment or delete the proxy entry. After I did this, I could connect to the public repositories. Make sure to accept the key Puppet uses to identify and sign their packages.

  1. [root@soa-training ~]# sudo rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
  2. Retrieving https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
  3. Preparing... ########################################### [100%]
  4. 1:puppetlabs-release ########################################### [100%]
  5. [root@soa-training ~]# yum install puppet
  6.  

When I first install Puppet on a host, I’m always interested in inspecting the local host facts. Facts are the key / value pairs that Puppet exposes to the Puppet Master or Agent, which can be used to make decisions on what needs to be applied to the system in question. These facts are also inserted into the PuppetDB, which normally is present in a Puppet Enterprise environment and can be queried to learn more about certain hosts.

The way you inspect these facts is by using a command line tool called facter.

  1. [root@soa-training ~]# facter
  2. architecture => x86_64
  3. augeasversion => 1.0.0
  4. bios_release_date => 12/01/2006
  5. bios_vendor => innotek GmbH
  6. bios_version => VirtualBox
  7. blockdevice_sda_model => VBOX HARDDISK
  8. blockdevice_sda_size => 26843545600
  9. blockdevice_sda_vendor => ATA
  10. blockdevice_sdb_model => VBOX HARDDISK
  11. blockdevice_sdb_size => 26843545600
  12. blockdevice_sdb_vendor => ATA
  13. blockdevice_sdc_model => VBOX HARDDISK
  14. blockdevice_sdc_size => 34359738368
  15. blockdevice_sdc_vendor => ATA
  16. blockdevice_sr0_model => CD-ROM
  17. blockdevice_sr0_size => 1073741312
  18. blockdevice_sr0_vendor => VBOX
  19. blockdevices => sda,sdb,sdc,sr0
  20. boardmanufacturer => Oracle Corporation
  21. boardproductname => VirtualBox
  22. boardserialnumber => 0
  23. domain => home
  24. facterversion => 2.4.6
  25. filesystems => ext4,iso9660
  26. fqdn => soa-training.home
  27. gid => root
  28. hardwareisa => x86_64
  29. hardwaremodel => x86_64
  30. hostname => soa-training
  31. id => root
  32. interfaces => eth4,lo
  33. ipaddress => 10.0.2.15
  34. ipaddress_eth4 => 10.0.2.15
  35. ipaddress_lo => 127.0.0.1
  36. is_virtual => true
  37. kernel => Linux
  38. kernelmajversion => 3.8
  39. kernelrelease => 3.8.13-44.el6uek.x86_64
  40. kernelversion => 3.8.13
  41. lsbdistcodename => n/a
  42. lsbdistdescription => Oracle Linux Server release 6.7
  43. lsbdistid => OracleServer
  44. lsbdistrelease => 6.7
  45. lsbmajdistrelease => 6
  46. lsbminordistrelease => 7
  47. lsbrelease => :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
  48. macaddress => 08:00:27:7D:1B:86
  49. macaddress_eth4 => 08:00:27:7D:1B:86
  50. manufacturer => innotek GmbH
  51. memoryfree => 4.15 GB
  52. memoryfree_mb => 4245.78
  53. memorysize => 7.80 GB
  54. memorysize_mb => 7988.01
  55. mtu_eth4 => 1500
  56. mtu_lo => 65536
  57. netmask => 255.255.255.0
  58. netmask_eth4 => 255.255.255.0
  59. netmask_lo => 255.0.0.0
  60. network_eth4 => 10.0.2.0
  61. network_lo => 127.0.0.0
  62. operatingsystem => OracleLinux
  63. operatingsystemmajrelease => 6
  64. operatingsystemrelease => 6.7
  65. os => {"name"=>"OracleLinux", "lsb"=>{"majdistrelease"=>"6", "distrelease"=>"6.7", "minordistrelease"=>"7", "distid"=>"OracleServer", "distdescription"=>"Oracle Linux Server release 6.7", "distcodename"=>"n/a", "release"=>":base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch"}, "release"=>{"major"=>"6", "minor"=>"7", "full"=>"6.7"}, "family"=>"RedHat"}
  66. osfamily => RedHat
  67. partitions => {"sdb1"=>{"filesystem"=>"ext4", "uuid"=>"104d0e7f-e4ff-4ebb-9282-6bf59a5dd1a9", "size"=>"52426752", "mount"=>"/u01"}, "sda1"=>{"filesystem"=>"ext4", "uuid"=>"10e949d3-7099-4e7e-a89a-398f10d083e3", "size"=>"1024000", "mount"=>"/boot"}, "sda2"=>{"filesystem"=>"LVM2_member", "size"=>"51402752"}}
  68. path => /usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
  69. physicalprocessorcount => 1
  70. processor0 => Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz
  71. processor1 => Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz
  72. processorcount => 2
  73. processors => {"models"=>["Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz", "Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz"], "count"=>2, "physicalcount"=>1}
  74. productname => VirtualBox
  75. ps => ps -ef
  76. puppetversion => 3.8.7
  77. rubyplatform => x86_64-linux
  78. rubysitedir => /usr/lib/ruby/site_ruby/1.8
  79. rubyversion => 1.8.7
  80. selinux => true
  81. selinux_config_mode => enforcing
  82. selinux_config_policy => targeted
  83. selinux_current_mode => enforcing
  84. selinux_enforced => true
  85. selinux_policyversion => 28
  86. serialnumber => 0
  87. sshdsakey => AAAAB3NzaC1kc3MAAACBAKZRL6z7cWPGJoD2cnMCrRTDbis4RiNZrZe3PKs/sNUvDqWNjBksNDW49SJ1xTtbCpwKrODG4qN6zXtY/eJGT+kwBf+edcNvWQqzwo7fPbEMVIkX5tRyAzZAu7YvWrrhxHuC6oSSa0rSWyHExlxgP4aYKKF9LbB/TAOzRUSQY++xAAAAFQD2QJq0WovnGViFYIrxpYPFwOoMkwAAAIBPvM6kN5RbdOetS1qWVk0DG67C6rhDNEWkR2/Yll8TA6o/aQRVIfykmo5DLvyjgTzGeiPpPLpghTWLjEgtBjxO7dHMRhnedDo8PhG2AQeWUDrU/4ipdVwQUPCxOXJdJrAIjnPJqVYkpDEmoWvr5l6hPQSBraKmfUh8wGGwupXQgwAAAIBqlmC57XE26a78zuJjZksXuPcDjSv/PhruTBhtyKGZnNHRYeTZs1fU7tNRTntaF0USdeJq+yIm3BYkBh3cr3gVdC5R287gmc1LYmGI47srcXwq69QVwaO9nLY//uOID+d8E8+aw97sXo1Pf6oGq87Zy+EZqp0RF62KAM6VmFl6MA==
  88. sshfp_dsa => SSHFP 2 1 5d30663a5341205d264e6f137057943367ef1535
  89. SSHFP 2 2 8596647f5ac7e96306419fb61a48be5847256c81c5b9585e8efa67a58a922853
  90. sshfp_rsa => SSHFP 1 1 c38d3cbd68a1b45935406ac65dbf16fce4851529
  91. SSHFP 1 2 5ee3dd20d281a52493d8a191299c0dd855f7ab85aa2ee9be0d6e27de0e1f3cfc
  92. sshrsakey => AAAAB3NzaC1yc2EAAAABIwAAAQEA0mehVvIWW021Obm9Mo7qycPlzMFdAju1piRoaEkCLIUqToLesxkUByzcAvwF8p9EsZ5GDjH4rpS4fZsfUl3JejGTpzb1eHEl5M9P5nmNmCYZSR3wtgtyo56zR0r5AeAa/9RIM6iGkU3mGrunzp1cfLmZmK+SaTE9OmSdzVHBnWzilkVWRZqTzYtptcYbWLlbjCSlCuTg/c8rVn9qq/9jte/qwtPYQYKdc3mjqBvLBNej02r3T8C/uMhN/GxFdUahZLjkLqRnA8c/w3kbMuhBGsxWXO3S6NYRgSPughQhU3hDlHTtdvMjhXOPaidjc91vnE6pyyfNDRZhwDad+2g2vw==
  93. swapfree => 6.00 GB
  94. swapfree_mb => 6144.00
  95. swapsize => 6.00 GB
  96. swapsize_mb => 6144.00
  97. system_uptime => {"seconds"=>2538, "uptime"=>"0:42 hours", "days"=>0, "hours"=>0}
  98. timezone => PST
  99. type => Other
  100. uniqueid => 007f0100
  101. uptime => 0:42 hours
  102. uptime_days => 0
  103. uptime_hours => 0
  104. uptime_seconds => 2538
  105. uuid => E13F417C-AE61-4632-ABAB-594A87BA82D6
  106. virtual => virtualbox
  107. [root@soa-training ~]#

The reason I installed Puppet in a preconfigured WebLogic boss is because I want to inspect WebLogic data with Puppet. For this, we need external modules, which are quick to install, but Puppet has a lot of built-in options as well. As a sneak peak, we will look at some file resources below.

  1. [root@soa-training ~]# puppet resource file /etc/passwd
  2. file { '/etc/passwd':
  3. ensure => 'file',
  4. content => '{md5}943982ae9c22abaeaeeed023983adddd',
  5. ctime => 'Mon Mar 06 12:13:24 -0800 2017',
  6. group => '0',
  7. mode => '644',
  8. mtime => 'Mon Mar 06 12:13:24 -0800 2017',
  9. owner => '0',
  10. selrange => 's0',
  11. selrole => 'object_r',
  12. seltype => 'etc_t',
  13. seluser => 'system_u',
  14. type => 'file',
  15. }
  16. [root@soa-training ~]# puppet resource file /etc
  17. file { '/etc':
  18. ensure => 'directory',
  19. ctime => 'Mon Mar 06 12:13:39 -0800 2017',
  20. group => '0',
  21. mode => '755',
  22. mtime => 'Mon Mar 06 12:13:39 -0800 2017',
  23. owner => '0',
  24. selrange => 's0',
  25. selrole => 'object_r',
  26. seltype => 'etc_t',
  27. seluser => 'system_u',
  28. type => 'directory',
  29. }
  30. [root@soa-training ~]# puppet resource file
  31. Error: Could not run: Listing all file instances is not supported. Please specify a file or directory, e.g. puppet resource file /etc

As you can see, we inspected the /etc/passwd file, the /etc directory, and tried to do a Puppet resource file on all of the files Puppet could find. This last command would have shown us thousands of files, which is not desirable.

Step 2: configure Puppet to connect to the WebLocig domain

Puppet is not shipped with the modules needed to inspect WebLogic out of the box. In order to be able to see these resources, we need to install the Orawls module written by Edwin Biemond, which is the most comprehensive module I know of.

  1. [root@soa-training Desktop]# puppet module install biemond-orawls
  2. Notice: Preparing to install into /home/oracle/.puppetlabs/etc/code/modules ...
  3. Notice: Created target directory /home/oracle/.puppetlabs/etc/code/modules
  4. Notice: Downloading from https://forgeapi.puppet.com ...
  5. Notice: Installing -- do not interrupt ...
  6. /home/oracle/.puppetlabs/etc/code/modules
  7. └─┬ biemond-orawls (v2.0.3)
  8. ├── adrien-filemapper (v1.1.3)
  9. ├── fiddyspence-sleep (v1.2.0)
  10. ├── hajee-easy_type (v0.15.5)
  11. ├── puppetlabs-stdlib (v4.15.0)
  12. └── reidmv-yamlfile (v0.2.0)

Although this blog post is not about writing Puppet code, we need to do it anyway. Orawls needs to know how to connect to WebLogic. To do so, it stores a YAML file on the system containing connection details in a file that is readable by the root user only.

The manifest required for the demo box look like this:

  1. wls_setting { 'default':
  2. user => 'oracle',
  3. weblogic_home_dir => '/u01/fmw/soa/wlserver',
  4. connect_url => "t3://localhost:7001",
  5. weblogic_user => 'weblogic',
  6. weblogic_password => 'welcome1',
  7. use_default_value_when_empty => true
  8. }

Apply the manifest using Puppet apply: 

  1. [root@soa-training Desktop]# puppet apply soaenv.pp
  2. Notice: Compiled catalog for soa-training.home in environment production in 0.09 seconds
  3. Notice: /Stage[main]/Main/Wls_setting[default]/user: defined 'user' as 'oracle'
  4. Notice: /Stage[main]/Main/Wls_setting[default]/weblogic_home_dir: defined 'weblogic_home_dir' as '/u01/fmw/soa/wlserver'
  5. Notice: /Stage[main]/Main/Wls_setting[default]/weblogic_user: defined 'weblogic_user' as 'weblogic'
  6. Notice: /Stage[main]/Main/Wls_setting[default]/connect_url: defined 'connect_url' as 't3://localhost:7001'
  7. Notice: /Stage[main]/Main/Wls_setting[default]/weblogic_password: created password
  8. Notice: /Stage[main]/Main/Wls_setting[default]/debug_module: defined 'debug_module' as 'false'
  9. Notice: /Stage[main]/Main/Wls_setting[default]/archive_path: defined 'archive_path' as '/tmp/orawls-archive'
  10. Notice: /Stage[main]/Main/Wls_setting[default]/custom_trust: defined 'custom_trust' as 'false'
  11. Notice: /Stage[main]/Main/Wls_setting[default]/use_default_value_when_empty: defined 'use_default_value_when_empty' as 'true'
  12. Notice: Finished catalog run in 0.10 seconds

Step 3: inspect resources

We’re finally done making preparations and can now take a look at our beloved WebLogic resources. I’ve included some examples below.

  1. [root@soa-training ~]# puppet resource wls_jms_topic
  2. wls_jms_topic { 'default/BAMJMSSystemResource:oracle.beam.cqs.activedata':
  3. ensure => 'present',
  4. consumptionpaused => '0',
  5. defaulttargeting => '0',
  6. deliverymode => 'No-Delivery',
  7. distributed => '0',
  8. expirationpolicy => 'Discard',
  9. insertionpaused => '0',
  10. jndiname => 'topic/oracle.beam.cqs.activedata',
  11. productionpaused => '0',
  12. redeliverydelay => '-1',
  13. redeliverylimit => '-1',
  14. subdeployment => 'BAMJMSSubDeployment',
  15. timetodeliver => '-1',
  16. timetolive => '-1',
  17. }
  18. wls_jms_topic { 'default/BAMJMSSystemResource:oracle.beam.persistence.activedata':
  19. ensure => 'present',
  20. consumptionpaused => '0',
  21. defaulttargeting => '0',
  22. deliverymode => 'No-Delivery',
  23. distributed => '0',
  24. expirationpolicy => 'Discard',
  25. insertionpaused => '0',
  26. jndiname => 'topic/oracle.beam.server.event.dataobject',
  27. productionpaused => '0',
  28. redeliverydelay => '-1',
  29. redeliverylimit => '-1',
  30. subdeployment => 'BAMJMSSubDeployment',
  31. timetodeliver => '-1',
  32. timetolive => '-1',
  33. }
  1. [root@soa-training Desktop]# puppet resource wls_domain
  2. wls_domain { 'default/compact_domain':
  3. ensure => 'present',
  4. credential => '<encrypted credential>',
  5. exalogicoptimizationsenabled => '0',
  6. jmx_platform_mbean_server_enabled => '0',
  7. jmx_platform_mbean_server_used => '1',
  8. jpa_default_provider => 'org.eclipse.persistence.jpa.PersistenceProvider',
  9. jta_max_transactions => '10000',
  10. jta_transaction_timeout => '30',
  11. log_date_pattern => 'MMM d, yyyy h:mm:ss a z',
  12. log_domain_log_broadcast_severity => 'Notice',
  13. log_file_min_size => '500',
  14. log_filecount => '7',
  15. log_filename => 'logs/compact_domain.log',
  16. log_number_of_files_limited => '1',
  17. log_rotate_logon_startup => '1',
  18. log_rotationtype => 'bySize',
  19. security_crossdomain => '0',
  20. setconfigurationaudittype => 'none',
  21. setinternalappdeploymentondemandenable => '0',
  22. web_app_container_show_archived_real_path_enabled => '0',
  23. }
  1. [root@soa-training Desktop]# puppet resource wls_server
  2. wls_server { 'default/AdminServer':
  3. ensure => 'present',
  4. auto_restart => '1',
  5. autokillwfail => '0',
  6. client_certificate_enforced => '0',
  7. custom_identity => '0',
  8. frontendhttpport => '0',
  9. frontendhttpsport => '0',
  10. jsseenabled => '1',
  11. listenport => '7001',
  12. listenportenabled => '1',
  13. log_datasource_filename => 'logs/datasource.log',
  14. log_date_pattern => 'MMM d, yyyy h:mm:ss a z',
  15. log_file_min_size => '500',
  16. log_filecount => '7',
  17. log_http_file_count => '7',
  18. log_http_filename => 'logs/access.log',
  19. log_http_format => 'date time cs-method ctx-ecid ctx-rid cs-uri sc-status bytes',
  20. log_http_format_type => 'extended',
  21. log_http_number_of_files_limited => '1',
  22. log_log_file_severity => 'Trace',
  23. log_number_of_files_limited => '1',
  24. log_redirect_stderr_to_server => '0',
  25. log_redirect_stdout_to_server => '0',
  26. log_rotate_logon_startup => '1',
  27. log_rotationtype => 'bySize',
  28. log_stdout_severity => 'Notice',
  29. logfilename => 'logs/AdminServer.log',
  30. logintimeout => '5000',
  31. max_message_size => '10000000',
  32. restart_max => '2',
  33. server_parameters => 'None',
  34. sslenabled => '0',
  35. sslhostnameverificationignored => '0',
  36. sslhostnameverifier => 'None',
  37. ssllistenport => '7002',
  38. tunnelingenabled => '0',
  39. two_way_ssl => '0',
  40. useservercerts => '0',
  41. weblogic_plugin_enabled => '0',
  42. }

The fun part is that this is valid Puppet code! Copy the output from the Puppet resource, paste it into a file and change what you want to change. The do a ‘Puppet apply FILENAME.pp’ and the changes should populate. This way you can start out small by managing WebLogic with Puppet and discover the available parameters in a non-destructive way.

Bas Langenberg
About the author Bas Langenberg

Bas Langenberg is a WebLogic and Oracle Fusion Middleware consultant.

More posts by Bas Langenberg
Comments
Reply