Gain control of your MQ versions and fixpacks

Using Puppet to (re)gain control of your MQ versions and fixpacks Many larger organizations use the IBM MQ as messaging middleware. Sometimes the IT infrastructure needed to run MQ can span a large number of nodes. This large number of nodes increases the issue of ensuring all systems run a correct fixpack or even a correct version of the MQ software. Having MQ running on multiple operating systems like AIX, Linux, Solaris, and Windows increases the complexity of this problem.

Using a combination of Puppet’s desired state and Puppet tasks, you can easily (re)gain control of your MQ versions and fixpacks on a large fleet of systems using multiple operating systems.

Puppet Desired State Language

The most known feature of Puppet is the Puppet desired state management. With this feature, you specify how a system should be configured using the Puppet language. The Puppet language allows you to specify certain external data. This is called hiera. Our Puppet IBM modules use this feature extensively.

Here is an example of the hiera data you can use to specify a particular MQ version and fixpack.

mq_install::fixpack::service_window:			   DIRECT
ibm_profile::mq_machine::software::version:  9.1.0.0
ibm_profile::mq_machine::fixpack::version:   9.1.0.7

When puppet run’s on a newly installed system, the part of the output that installs the MQ software looks like this:

Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.1.0.0]/Archive[/tmp/IBM_MQ_9.1.0.0_LINUX_X86-64.tar.gz]/ensure: download archive from /vagrant/modules/software/files/IBM_MQ_9.1.0.0_LINUX_X86-64.tar.gz to /tmp/IBM_MQ_9.1.0.0_LINUX_X86-64.tar.gz and extracted in /tmp with cleanup
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.1.0.0]/Exec[Accept MQ License Requirements]/returns: executed successfully
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.1.0.0]/Package[MQSeriesRuntime-9.1.0-0]/ensure: created
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.1.0.0]/Package[MQSeriesJRE-9.1.0-0]/ensure: created
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.1.0.0]/Package[MQSeriesJava-9.1.0-0]/ensure: created
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.1.0.0]/Package[MQSeriesServer-9.1.0-0]/ensure: created
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.1.0.0]/File[Remove temporary files]/ensure: removed
Notice: /Stage[main]/Mq_install::Fixpack/File[/tmp/mq_fixpack_9.1.0.7]/ensure: created
Notice: /Stage[main]/Mq_install::Fixpack/Archive[/tmp/9.1.0-IBM-MQ-LinuxX64-FP0007.tar.gz]/ensure: download archive from puppet:///modules/software/9.1.0-IBM-MQ-LinuxX64-FP0007.tar.gz to /tmp/9.1.0-IBM-MQ-LinuxX64-FP0007.tar.gz and extracted in /tmp/mq_fixpack_9.1.0.7 with cleanup
Notice: /Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9107-9.1.0-7]/Package[MQSeriesRuntime-U9107-9.1.0-7]/ensure: created
Notice: /Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9107-9.1.0-7]/Package[MQSeriesJRE-U9107-9.1.0-7]/ensure: created
Notice: /Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9107-9.1.0-7]/Package[MQSeriesJava-U9107-9.1.0-7]/ensure: created
Notice: /Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9107-9.1.0-7]/Package[MQSeriesServer-U9107-9.1.0-7]/ensure: created
Notice: /Stage[main]/Mq_install::Fixpack/Exec[Remove temporary files for fixpack 9.1.0.7]/returns: executed successfully

As you can see, all steps needed to fetch the MQ software and fixpack and actions required to install them are automated. Because Puppet uses idempotency, on a second Puppet run, Puppet detects that the correct versions are installed, and Puppet will do nothing.

Performing a fixpack update

If a system has been provisioned previously with the hiera data displayed above, The system will be running MQ 9.1.0.7. If we want to update to fixpack 8 (e.g., version 9.1.0.8), we only need to change the hiera data. Here is how it needs to look.

mq_install::fixpack::service_window:			   DIRECT
ibm_profile::mq_machine::software::version:  9.1.0.0
ibm_profile::mq_machine::fixpack::version:   9.1.0.8

If Puppet now runs on this system, it determines that you have specified a newer version of the fixpack. Because the service_window parameter is set to DIRECT, it will immediately shut down MQ and apply the required fixpack. After the upgrade is done, Puppet will automatically restart all previously running MQ queue managers.

Here is some example output:

Notice: /Stage[main]/Mq_install::Internal::Mq_stop/Exec[Stop MQ manager QM01]/returns: executed successfully
Notice: /Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9108-9.1.0-8]/Package[MQSeriesRuntime-U9108-9.1.0-8]/ensure: created
Notice: /Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9108-9.1.0-8]/Package[MQSeriesJRE-U9108-9.1.0-8]/ensure: created
Notice: /Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9108-9.1.0-8]/Package[MQSeriesJava-U9108-9.1.0-8]/ensure: created
Notice: /Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9108-9.1.0-8]/Package[MQSeriesServer-U9108-9.1.0-8]/ensure: created
Notice: /Stage[main]/Mq_install::Fixpack/Exec[Remove temporary files for fixpack 9.1.0.8]/returns: executed successfully
Notice: /Stage[main]/Ibm_profile::Mq_machine::Manager_setup/Mq_manager[QM01]/status: status changed 'Ended normally' to 'Running'
Notice: /Stage[main]/Ibm_profile::Mq_machine::Autostart/Mq_install::Autostart[QM01]/Exec[stop QM01 running outside systemd]/returns: executed successfully
Notice: /Stage[main]/Ibm_profile::Mq_machine::Autostart/Mq_install::Autostart[QM01]/Service[mq@QM01]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Ibm_profile::Mq_machine::Autostart/Mq_install::Autostart[QM01]/Service[mq@QM01]: Unscheduling refresh on Service[mq@QM01]

On the next Puppet run, Puppet will detect that the correct versions are installed, and Puppet will do nothing.

Oh Oh, issues

Although you have prepared everything meticulously, sometimes things go wrong, and you have to roll back to the previous. Fortunately, Puppet can help you here too: Just change the hiera data back and run Puppet again.

Here is the example output.

Notice: /Stage[main]/Mq_install::Internal::Mq_stop/Exec[Stop MQ manager QM01]/returns: executed successfully
Notice: /Stage[main]/Mq_install::Fixpack/Exec[uninstall fixpack U9108]/returns: executed successfully
Notice: /Stage[main]/Ibm_profile::Mq_machine::Manager_setup/Mq_manager[QM01]/status: status changed 'Ended normally' to 'Running'
Notice: /Stage[main]/Ibm_profile::Mq_machine::Autostart/Mq_install::Autostart[QM01]/Exec[stop QM01 running outside systemd]/returns: executed successfully
Notice: /Stage[main]/Ibm_profile::Mq_machine::Autostart/Mq_install::Autostart[QM01]/Service[mq@QM01]/ensure: ensure changed 'stopped' to 'running'

As you can see, fixpack U9108 is uninstalled, and the situation is back to before the fixpack update.

Performing a major update

At this point in time, MQ version 9.2 is the latest. Let’s update the systems to this version. Here is the required hiera data.

mq_install::software::service_window:        DIRECT
ibm_profile::mq_machine::software::version:  9.2.0.0
# ibm_profile::mq_machine::fixpack::version: This needs to unset when no fixpack is installed

The process is the same as with the installation of a fixpack. Puppet determines that you have requested a new major version. It will shut down all running MQ managers, uninstall the old software, install the new major version and start the queue managers again.

Notice: /Stage[main]/Mq_install::Internal::Mq_stop/Exec[Stop MQ manager QM01]/returns: executed successfully
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.2.0.0]/Exec[uninstall RPMS for version 9.1.0.7]/returns: executed successfully
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.2.0.0]/Archive[/tmp/IBM_MQ_9.2.0_LINUX_X86-64.tar.gz]/ensure: download archive from /vagrant/modules/software/files/IBM_MQ_9.2.0_LINUX_X86-64.tar.gz to /tmp/IBM_MQ_9.2.0_LINUX_X86-64.tar.gz and extracted in /tmp with cleanup
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.2.0.0]/Exec[Accept MQ License Requirements]/returns: executed successfully
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.2.0.0]/Package[MQSeriesRuntime-9.2.0-0]/ensure: created
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.2.0.0]/Package[MQSeriesGSKit-9.2.0-0]/ensure: created
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.2.0.0]/Package[MQSeriesJRE-9.2.0-0]/ensure: created
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.2.0.0]/Package[MQSeriesJava-9.2.0-0]/ensure: created
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.2.0.0]/Package[MQSeriesServer-9.2.0-0]/ensure: created
Notice: /Stage[main]/Mq_install::Software/Mq_install::Software::Unix[mq_installation_9.2.0.0]/File[Remove temporary files]/ensure: removed
Notice: /Stage[main]/Ibm_profile::Mq_machine::Manager_setup/Mq_manager[QM01]/status: status changed 'Ended normally' to 'Running'
Notice: /Stage[main]/Ibm_profile::Mq_machine::Autostart/Mq_install::Autostart[QM01]/Exec[stop QM01 running outside systemd]/returns: executed successfully
Notice: /Stage[main]/Ibm_profile::Mq_machine::Autostart/Mq_install::Autostart[QM01]/Service[mq@QM01]/ensure: ensure changed 'stopped' to 'running'

When to update

Before you can apply a fixpack or even install a new major version of MQ, you are required to shut down the running MQ software on your system. Obviously, you want control over when you do this. You don’t want Puppet to shut down your MQ messaging during operating hours. One of the ways to get control over this is to specify a time frame for you service_window parameter. Let’s say you are allowed to shut down your MQ software every night between 1:00 and 2:00. You can tell Puppet this by setting the service_window.

mq_install::fixpack::service_window:    1 - 2
mq_install::software::service_window:   1 - 2 

This means that Puppet will skip the shutdown and installation of a new fixpack or major version every time unless it is currently running in the service window.

How about an initial install outside the service window

When you are installing a brand new system, you probably don’t need to adhere to the service window because no users are using the system yet. The MQ modules will detect this use-case and install any requested fixpack on initial install

We need more control

Although the service window gives you a lot more control, for some organizations, it is not enough. Maybe you need to contact your business and use a precise moment for a subset of systems. For this use case, we can use the Puppet plan (or Bolt plan). In this blog post, we will show you the bolt commands.

To tell the Puppet agent to leave the MQ versions like they are, we need to specify the next hiera data:

mq_install::fixpack::service_window:    INSTALL_ONLY
mq_install::software::service_window:   INSTALL_ONLY

This means that only on a first Puppet run, Puppet will install the software and the fixpack, but Puppet will never do an update. To actually do the update, we need to run a bolt plan.

Puppet/Bolt plans

Here is the command that shows the available bolt plans.

$ bolt plan show --modulepath /etc/puppetlabs/code/environments/production/modules/ | grep mq_install
  mq_install::apply_fixpack           Apply the in hiera specified MQ fixpack to the specified nodes.
  mq_install::apply_upgrades          Apply the in hiera specified MQ upgrades to the specified nodes.

Let’s see some more information about the plan mq_install::apply_fixpack .

bolt plan show --modulepath /etc/puppetlabs/code/environments/production/modules/ mq_install::apply_fixpack
mq_install::apply_fixpack
  Apply the in hiera specified MQ fixpack to the specified nodes.

Usage
  bolt plan run mq_install::apply_fixpack targets=<value>

Parameters
  targets  TargetSpec
    The MQ node(s) you want to apply a software update to

Module
  /etc/puppetlabs/code/environments/production/modules/mq_install

As you can see, the bolt plan takes a parameter called targets. You can pass a comma-separated list of target names, wildcard patterns, or group names to a plan parameter of type TargetSpec. For more information on the TargetSpec type, see Writing plans in the Puppet language. The fact that you can specify specific target nodes means that you can precisely select the nodes you want to update the MQ fixpack with a bolt plan. The plan is executed directly and concurrently on all specified target nodes.

Here is an example of this running on a node.

$ bolt plan run --modulepath /etc/puppetlabs/code/environments/production/modules/ --hiera_config /etc/puppetlabs/code/environments/production/hiera.yaml mq_install::apply_fixpack  targets=mq01.example.com
Starting: plan mq_install::apply_fixpack
Starting: Uploading Enterprise Modules run-time information... on mq01.example.com
Finished: Uploading Enterprise Modules run-time information... with 0 failures in 0.04 sec
Starting: install puppet and gather facts on mq01.example.com
Finished: install puppet and gather facts with 0 failures in 5.88 sec
Starting: apply catalog on mq01.example.com
Finished: apply catalog with 0 failures in 53.43 sec
Puppet: When a fixpack update is detected, it will take place directly without any schedule
Puppet: When a software update is detected, it will be skipped, because service window is set to INSTALL_ONLY
/Stage[main]/Mq_install::Fixpack/File[/tmp/mq_fixpack_9.1.0.8]/ensure: created
/Stage[main]/Mq_install::Fixpack/Archive[/tmp/9.1.0-IBM-MQ-LinuxX64-FP0008.tar.gz]/ensure: download archive from /vagrant/modules/software/files/9.1.0-IBM-MQ-LinuxX64-FP0008.tar.gz to /tmp/9.1.0-IBM-MQ-LinuxX64-FP0008.tar.gz and extracted in /tmp/mq_fixpack_9.1.0.8 with cleanup
/Stage[main]/Mq_install::Internal::Mq_stop/Exec[Stop MQ manager QM01]/returns: executed successfully
/Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9108-9.1.0-8]/Package[MQSeriesRuntime-U9108-9.1.0-8]/ensure: created
/Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9108-9.1.0-8]/Package[MQSeriesJRE-U9108-9.1.0-8]/ensure: created
/Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9108-9.1.0-8]/Package[MQSeriesJava-U9108-9.1.0-8]/ensure: created
/Stage[main]/Mq_install::Fixpack/Mq_install::Internal::Mq_packages[U9108-9.1.0-8]/Package[MQSeriesServer-U9108-9.1.0-8]/ensure: created
/Stage[main]/Mq_install::Fixpack/Exec[Remove temporary files for fixpack 9.1.0.8]/returns: executed successfully
/Stage[main]/Main/Mq_install::Autostart[QM01]/Service[mq@QM01]/ensure: ensure changed 'stopped' to 'running'
Puppet: Applied catalog in 41.75 seconds
Finished: plan mq_install::apply_fixpack in 1 min, 1 sec
Plan completed successfully with no result

Experience the Power of Puppet for IBM MQ

If you want to play and experiment with Puppet and IBM MQ, please take a look at our playgrounds. At our playgrounds, we provide you with a pre-installed environment, where you experiment fast and easy.

Conclusion

In this blog post, we have shown you easy it is to (re)gain control of the MQ fixpacks and versions you are running on your fleet of systems. Puppet, in combination with the Puppet modules for MQ make it very easy to automate this work. The Puppet desired state language can work seamlessly with Puppet(Bolt) plans to give you full control over the timing of your updates. Because the modules support multiple operating systems, your entire MQ fleet can be managed with one single approach and set of tools.

If you would like to know more, contact us at info@enterprisemodules.com or by phone: +31 (0)30-601 6000

About us

Enterprise modules is the leading developer of enterprise-ready puppet modules for Oracle databases,Oracle WebLogic, and IBM MQ software. Our puppet modules help sysadmins and DBAs to automate the installation, configuration, and management of their databases and application server systems. These modules allow them to make managed, consistent, repeatable, and fast changes to their infrastructure and automatically enforce the consistency. We are a proud member of the Conclusion family.

Conclusion is thé multidisciplinary service provider in the field of Business Transformation and IT Services. Our tagline? Business Done Differently. Our 1250 specialists and professionals live up to that every day by truly combining our IT knowledge with business and domain know-how. With dedication, creativity, and flexibility, we take responsibility for the social and mission-critical business processes and systems of our customers and enable organizations to digitally transform their business model. Our primary focus is on the Dutch market and more specifically on the domains of Public Transport, Healthcare, Finance, and Industry. Conclusion. Business Done Differently