In this playground we will show you how easy it is to manage yourMQ messaging set-up with Puppet. How you can add and manage queues, topics, queues etc.
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.
On the playground system, you will find MQ already installed. We have installed it using the ibm_profile module. The playground will guide you in your customisations.
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 mq_config 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:
Add a MQ manager
Add a MQ topic
Add a MQ channel
Add MQ authorization
Add a MQ queue
Happy exploring!!
Add a MQ manager
In this section, we will create a MQ queue manager. It is needed to use the queue service. More information about queue managers you can find on IBM queue managers documentation website.
In the editor tab, go to the directory hierdata\nodes and open the file mq91.playground.enterprisemodules.com.yaml.
In the install playground, manager_setup was unskipped in the following line:
# ibm_profile::mq_machine::manager_setup: skip
This tells Puppet to proceed with setting up Mq Manager based on data from yaml. Manager setup class, looks for the ibm_profile::mq_managers list. More detailes, can be found in the documentation. Your hiera should look something like this now:
The parameter ensure in the yaml tell’s Puppet to ensure that manager with a name QM1, with given params, is present on the machine. More detailed params description can be found in the documentation.
Run Puppet
Let’s see what Puppet has got in store for us now and run Puppet.
puppet apply site.pp
The result should be similar to the following:
Notice: Compiled catalog for mq91.playground.enterprisemodules.com in environment production in 0.87 seconds
Notice: MQ limits
Notice: MQ Groups and Users
Notice: MQ Packages
Notice: MQ version 9.1.0.0 software from /install
Notice: Ensure MQ Manager(s) QM01
Notice: /Stage[main]/Ibm_profile::Mq_machine::Manager_setup/Mq_manager[QM01]/status: status changed 'Ended immediately' to 'Running'
Notice: Applied catalog in 2.15 seconds
Re-run Puppet and check idempotency
What happens now if we run Puppet again:
puppet apply site.pp
Puppet detects everything is as it is described in your Puppet manifest and hiera settings and changes nothing. It is idempotent.
Inspect changes
To see the result of applied changes, you can write the following command in the console:
More about puppet resource command will be written in the inside section. In this section, this command will be used to check results only.
Add a MQ topic
In this section, we will add a MQ topic to the queue manager.
In the editor tab, go to the directory hierdata\nodes and open the file mq91.playground.enterprisemodules.com.yaml.
Your hiera should look something like this now:
# ibm_profile::mq_machine::messaging_setup::topic_list:# QM01/TOPIC_1:# ensure: present# descr: My own topic# topicstr: topic_1
You can create mq_topic by uncommenting the code and running puppet. The same way as mq_manager was created, however this time it will be done a different way. Mq_topic is a type created by Enterprise Modules. You need to fill topicstr parameter and ensure parameter. Parameter ensure in the tell’s Puppet to ensure that topic with name QM01/TOPIC_1, with given params is present on the machine. More detailed params description can be found in the documentation.
Let’s uncomment following code:
ibm_profile::mq_machine::messaging_setup::channel_list:QM01/TOPIC_1:ensure:presentdescr:My own topictopicstr:topic_1
Run Puppet
Let’s see what Puppet has got in store for us now and run Puppet.
puppet apply a.pp
The result should be similar to the following:
Notice: Compiled catalog for mq91.playground.enterprisemodules.com in environment production in 0.09 seconds
Notice: /Stage[main]/Main/Mq_topic[QM01/TOPIC_1]/ensure: created
Notice: Applied catalog in 1.70 seconds
Re-run Puppet and check idempotency
What happens now if we run Puppet again:
puppet apply site.pp
Puppet detects everything is as it is described in your Puppet manifest and hiera settings and changes nothing. It is idempotent.
Inspect changes
To see the result of applied changes, you can write the following command in the console:
More about puppet resource command will be written in the inside section. In this section, this command will be used to check results only.
Add a MQ channel
In this section we will add a channel to the MQ setup. Your hiera should look something like this now:
In the editor tab, go to the directory hierdata\nodes and open the file mq91.playground.enterprisemodules.com.yaml.
Your hiera should look something like this now:
Mq_topic is a type created by Enterprise Modules. You need to fill the topicstr parameter and ensure parameter.
The parameter ensure in the tell’s Puppet to ensure that topic with the name QM01/TOPIC_2, with given params is present on the machine. More detailed params description can be found in the documentation.
Run Puppet
Let’s see what Puppet has got in store for us now and run Puppet. If you put your content in the yaml, you need to run
puppet apply side.pp
The result should be similar to the following:
Notice: /Stage[main]/Main/Mq_channel[QM01/CHANNEL_1]/ensure: created
Notice: /Stage[main]/Main/Mq_channel[QM01/ADMIN]/ensure: created
Notice: Applied catalog in 4.08 seconds
Re-run Puppet and check idempotency
What happens now if we run Puppet again?
If you put your content in the yaml, you need to run
puppet apply side.pp
Puppet detects everything is as it is described in your Puppet manifest and hiera settings and changes nothing. It is idempotent.
Inspect changes
To see the result of applied changes, you can write the following command in the console:
More about puppet resource command will be written in the inside section. In this section, this command will be used to check results only.
Add MQ authorization
In this section, we will add some authorization.
In the editor tab, go to the directory hierdata\nodes and open the file mq91.playground.enterprisemodules.com.yaml.
Your hiera should look something like this now:
More about puppet resource command will be written in the inside section. In this section, this command will be used to check results only.
Removing puppet components
Uups, we have created mq_authorization object for TOPIC_2, but we don’t have TOPIC_2.
Let’s try to remove object mq_authorization 'group/mqm->QM01/topic/TOPIC_1'.
To do it, open hiera and change group/mqm->QM01/topic/TOPIC_2 in the following way:
group/mqm->QM01/topic/TOPIC_2:ensure:absent
Notice, that even if you remove a component, you NEED to fill the required class parameters. You can remove other components like mq_topic, mq_channel or mq_manager in the same way.
Run Puppet
Let’s see what Puppet has got in store for us now and run Puppet.
puppet apply c.pp
The result should be similar to the following:
Notice: Compiled catalog for mq91.playground.enterprisemodules.com in environment production in 0.05 seconds
Notice: /Stage[main]/Main/Mq_authorization[group/mqm->QM01/topic/TOPIC_2]/ensure: removed
Notice: Applied catalog in 0.51 seconds
Re-run Puppet and check idempotency
What happens now if we run Puppet again:
puppet apply c.pp
Puppet detects everything is as it is described in your Puppet manifest and hiera settings and changes nothing. It is idempotent.
Inspect changes
To see the result of applied changes, you can write the following command in the console:
As you can see, group/mqm->QM01/topic/TOPIC_2 is absent.
More about puppet resource command will be written in the inside section. In this section, this command will be used to check results only.
Add a MQ queue
And last, but not least we will add a queue to the MQ setup.
In the editor tab, go to the directory hierdata\nodes and open the file mq91.playground.enterprisemodules.com.yaml.
Your hiera should look something like this now: