Using vCenter Orchestrator with RabbitMQ and vCloud Director – Part 4

Overview

In this post we are going to install the vCloud Director Notification Package, subscribe to a RabbitMQ queue and then configure vCenter Orchestrator to monitor to the newly created queue.

Installing the vCloud Director Notification Package

The vCloud Director Notification Package has various workflows, actions, etc that will allow us to parse AMQP notification messages from vCloud Director and act on them.  By avoiding this heavy lifting, we can focus on using the parsed values in our workflows. Go to https://communities.vmware.com/docs/DOC-20446 and select the download link for com.vmware.coe.vcd55.notifications.package.zip. Unzip the archive and you’re left with a file named com.vmware.coe.vcd55.notifications.package.

From the the vCO client:

  1. Select Administer from the drop-down menu
  2. Select the Packages tab
  3. Select Import package
  4. Select the file com.vmware.coe.vcd55.notifications.package
  5. Select Open

2014-10-21_17-32-17

Select Import on the following screen:

2014-10-21_17-32-48

I’ve already imported the package so there is nothing selected, but you should have a lot of items with green arrows that will be imported:

2014-10-21_17-32-58

Once the import is finished, you’ll see a new package with various workflows, actions, etc:

2014-10-21_17-34-14

 

Subscribing to a RabbitMQ queue

In the vCO client go to the workflow tab and then Library > AMQP > Configuration.  Right-click the Subscribe to queues workflow and set select Start Workflow. Give the queue a name and select Next

2014-10-21_18-00-05

2014-10-21_18-00-39

Select your broker and click Next.

2014-10-21_18-02-21

Select Not Set and enter the name of your test queue in the in the New value field.  Once you’ve entered your queue name select Accept.

2014-10-21_18-02-48

My Queue section looks like:

2014-10-21_18-03-02

Press submit and it should complete successfully:

2014-10-21_18-03-34

 

Creating a new policy

Here is where we will create a policy that will tell vCO to monitor a RabbitMQ queue for messages and to run a workflow when a new message is found.

  1. Select the Run menu
  2. Select the Policies tab
  3. Create the new policy

2014-10-21_18-16-49

Edit the new policy:

2014-10-21_18-17-16

  1. Select Add policy element
  2. Select AMQP:Subscription
  3. Press OK

Type the name of your queue, select it and press Select.

2014-10-21_18-18-57

Select the AMQP:Subscription line and then select Add trigger event.

2014-10-21_18-33-22

Select OnMessage and then Select Trigger.

2014-10-21_18-20-17

It should now look like this (not sure what’s up with the blue background):

2014-10-21_18-36-56

Select OnMessage and below you will notice that no workflow is set.  Click on the magnifying glass to search for a workflow to run:

2014-10-21_19-08-29

Select the highlighted workflow:

2014-10-21_19-10-09

Once you select the workflow you’ll notice that you have two new parameters that are not set:

2014-10-21_19-11-38

Click on not set for subscription and then select the highlighted entry below:

2014-10-21_19-12-03

Now do the same for messageBody:

2014-10-21_19-12-15

The result should look like:

2014-10-21_19-12-20

Start the policy by right-clicking on your policy and selecting Start policy. 

2014-10-21_19-15-27

The policy should now have a green arrow on it:

2014-10-21_19-16-36

In the next post we will configure the workflow that will run when a new message is found.


Using vCenter Orchestrator with RabbitMQ and vCloud Director – Part 3

Overview

In this post we are going to use vCO to create a RabbitMQ broker, exchange and a queue.  We will then bind to the queue so that we can send messages to the queue and retrieve them.

Adding a Broker

In the vCO client go to the workflow tab and then Library > AMQP.  Right-click the Add a broker workflow and set select Start Workflow. Give the broker a name and select Next.

2014-10-08_20-58-42

Fill in the RabbitMQ host, leave the virtual host as / unless you want to change it and know what you’re doing.  The credentials are guest / guest.

2014-10-08_20-59-25

If the workflow is successful, you will see:

2014-10-08_20-59-55

Declaring an Exchange

In the vCO client go to the workflow tab and then Library > AMQP.  Right-click on Declare an exchange and select Start Workflow.

  1. Select Not Set and browse to your broker
  2. Expand AMQP and select your broker
  3. Select Select

2014-10-08_21-08-52

Press Next and enter the following:

2014-10-21_20-05-33

Press Submit and if it completes successfully, you’ll see a green check.

2014-10-08_21-13-17

If you go to your RabbitMQ web interface, you’ll see the exchange we just created:

2014-10-08_21-15-17

Declaring a Queue

In the vCO client go to the workflow tab and then go to Library > AMQP.  Right-click on Declare a queue and select Start Workflow.

Select your broker as before:

2014-10-08_21-17-49

Fill in the following info:

2014-10-08_21-18-18

Select Submit and you should get a green check if the workflow completes successfully.

In the RabbitMQ web interface we can see the new queue:

2014-10-08_21-20-18

Binding to the Queue

In the vCO client go to the workflow tab and then go to Library > AMQP.  Right-click on Bind and select Start Workflow.

Select your broker and select Next:

2014-10-08_21-17-49

Fill in the following and press Submit.

2014-10-08_21-52-47

The routing key is “true.*.*.*.com.vmware.vcloud.event.blockingtask.create.vappDeploy”.  See Notification Message Format for more information on this. Once we have blocking tasks in vCloud set up, every time a vApp is deployed, a blocking task will go into this queue.  Now if we click on the queue in the RabbitMQ web interface, we will see the new binding:

2014-10-08_21-53-43

Sending a message to the queue

In the vCO client go to the workflow tab and then go to Library > AMQP.  Right-click on Send a text message and select Start Workflow.

Select your broker and select Next:

2014-10-08_21-17-49

Fill in the following and select Next:

2014-10-08_21-54-30

Type in a message and select Submit.  Sometimes here Submit isn’t highlighted so you have to press Back then Submit

2014-10-08_21-35-04

Back in the RabbitMQ web interface we see that a new message has arrived:

2014-10-08_21-35-48

We can also scroll down to the Get messages section and press Get Messages.

2014-10-08_21-55-24

Here we can see our message.  Set Requeue to No so that the message is removed off of the queue.

vCloud Director Configuration

Let’s do something a little more interesting and configure vCloud Director (vCD) to send messages to RabbitMQ when a vApp is deployed.  From the vCD portal, enter the following:

2014-10-08_21-39-12

Configure the blocking task:

  1. Select the Administration menu item
  2. Select Extensibility
  3. Check Start vApp (Deploy from API)
  4. Press Apply

2014-10-08_21-41-57

Go ahead and start any vApp.  You’ll see the status change to Pending processing…

2014-10-08_21-46-35

This time the payload has a lot of vCD related information such as the ids for the org, user, etc of the vApp that was attempted to be deployed:

2014-10-08_22-30-15

You could work with this data in the current format, but it’s much easier to use the vCD Notification Package.  This package will extract all the details from the blocking task and populate variables such as user, org, org vDC, etc.  It also allows you to run vCO workflows where you can use the data that was extracted out of the blocking task to do whatever you want.  For example, you could add the deployed system to a CMDB, call out to Infoblox to update the DNS, etc.  You probably want to use a different blocking task (vApp creation) type for this however.  There are two different types for creating vApps.  I’ll cover the vCD Notification Package and creating RabbitMQ subscriptions from vCO in the next post.

 

 

 


Using vCenter Orchestrator with RabbitMQ and vCloud Director – Part 2

Overview

In this entry in the series, we are going to install and configure the RabbitMQ vCO plug-in and configure the vCenter vCO plug-in.

Installing the RabbitMQ vCO plug-in

First we need to make sure we have the RabbitMQ pulg-in for vCO.  The easiest way to get it is to go http://www.vcoteam.info/ and click the gigantic orange banner and then select AMQP 1.0.3.  Once you download the plug-in you should have a file named o11nplugin-amqp-1.0.2-228.vmoapp.  Using a web browser to go your vCO server (mine is https://vco55b.vmware.local)

  1. Select Plug-ins
  2. Scroll to the bottom and select the magnifying glass
  3. Browse to the downloaded plug-in
  4. Select Upload and install

2014-10-07_20-32-56

You should now see:

2014-10-07_20-34-01

 

Adding vCenter to vCO

Since we are already here, let’s go ahead and add vCenter to vCO.

  1. Select Network
  2. Select SSL Trust Manager
  3. Enter the address of your vCenter server and press Import

2014-10-07_20-39-27

Select Import:

2014-10-07_20-39-45

  1. Select vCenter Server
  2. Enter your vCenter’s host name/IP
  3. I’m using the Share a unique session option so that all my workflows run as the specified user.
  4. Enter the user credentials that the workflows will run under.

To fully install the plug-ins we need to restart the vCO service:

  1. Select Startup Options
  2. Select Restart service

2014-10-07_20-45-26

The vCO Client

Using a web browser, go back to your vCO server.  you can either run the vCO client directly or install it.  The default credentials should be vcoadmin / vcoadmin.

2014-10-07_20-51-35

If we switch over to the Workflows tab, we can see the new AMQP workflows that were installed when we installed the RabbitMQ plug-in:

2014-10-07_20-52-14

Then if we select the Inventory tab, we can browse all the plug-in inventories.  Here I’m showing my vCenter inventory.

2014-10-07_20-52-46

The error messages you receive when logging into vCO can be pretty misleading.  If you’re having trouble logging in, you may need to your vCO server to your Java exception list.

2014-10-07_20-58-28

2014-10-07_21-00-07

In the next post I’ll go over how to use vCO to create the RabbitMQ Exchanges, queues, etc.


Using vCenter Orchestrator with RabbitMQ and vCloud Director – Part 1

Overview

This post will be the first part in a series on how to configure vCenter Orchestrator (vCO) to integrate with vCloud Director’s blocking tasks via RabbitMQ.  I’ll also try to cover some use cases that don’t involve vCloud Director and show how vCO can monitor RabbitMQ queues and execute vCO workflows.  Actually, most of this will revolve around vCO and RabbitMQ.

I’m not going to cover how to install vCO, but I’ll cover how to configure certain parts.  My testing was done with vCO 5.5.2, which can be downloaded at https://my.vmware.com/group/vmware/details?downloadGroup=VCL-VCOVA_552&productId=408&rPId=5635.  If you need help deploying vCO, you can see how to deploy an OVF/OVA at https://www.youtube.com/watch?v=uBXU8CBTKBk.  You can probably use the vCO that comes with vCenter, but I haven’t went that route in a while.  vCenter and the ESXi hosts are at 5.5 U2.  vCloud is at 5.5.2.2.

Installing RabbitMQ

I’ll be using the Windows version of RabbitMQ and will be installing it on my vCenter server that is running on Windows 2008 R2.  RabbitMQ can be downloaded at http://www.rabbitmq.com/install-windows.html.  I’m using the current version, which is 3.3.5 at this time.  When you start the installation you’ll be notified that you need to install Erlang and the installer will direct you to the Erlang download site:

2014-10-07_19-50-46

I installed version 17.3 of Erlang: http://www.erlang.org/download/otp_win64_17.3.exe.  You can now re-run the RabbitMQ installer.  Of course, you can install Erlang first and then run the RabbitMQ installer and you will not receive this message.

Configuring RabbitMQ

The first thing we need to do is enable the Web UI for RabbitMQ.  You don’t have to do this if you’re comfortable with doing all of the management from the command line.  Go to Start > All Programs > RabbitMQ Server > RabbitMQ Command Prompt (sbin dir).  At the command line run the command rabbitmq-plugins enable rabbitmq_management

Now you’ll be able to access RabbitMQ’s management interface by going to http://localhost:15672/ from the machine where you installed RabbitMQ.  The default credentials are guest/guest.   With this version of RabbitMQ, by default you can only access the web interface using the guest account from the local machine.  I’m sure you can create users from the command line and access the RabbitMQ service remotely, but I’m trying to keep it simple.  We need to modify RabbitMQ’s conf file and then re-install it for the change to take effect.  I’m not sure why this is the case.  I found this out from http://www.mariuszwojcik.com/tag/rabbitmq-config/.

Open a command prompt and run copy %APPDATA%\RabbitMQ\rabbitmq.config.example to %APPDATA%\RabbitMQ\rabbitmq.config.  Edit the new rabbitmq.config file and find this section (The %%s are comments).

%% The default “guest” user is only permitted to access the server
%% via a loopback interface (e.g. localhost).
%% {loopback_users, [<<“guest”>>]},
%%
%% Uncomment the following line if you want to allow access to the
%% guest user from anywhere on the network.
%% {loopback_users, []},

We want to change the last line to

{loopback_users, []},

Simply restarting the RabbitMQ service does not pick up the change.  We need to re-install it.  This is actually very easy to do.  Simply go to Start > All Programs > RabbitMQ Server > RabbitMQ Service – (re)install

 Configuring vCloud Director to talk to RabbitMQ

As a system admin in vCloud Director, go to the following section and fill in the highlighted areas.  The Exchange, vHost and Prefix fields don’t matter for now.  Once you’re done press Test AMQP Connection and it should succeed as long as the vCloud Director Cell can communicate to the AMQP host/port.

2014-10-07_20-12-41

In the next post I’ll go over how to configure the RabbitMQ vCO and vCenter plug-ins.