Automation Engine - How to use home brewed gems?

I’m aiming to add a state to the state machine that will use one of my own APIs.
For that, I’ve created a gem (using HTTParty) that will brew the requests and handle my API’s through simple methods.

My problem is that I don’t know how to install my gem in manage IQ in order to access it via the automation engine. That installation must be easy and the cleanest way possible.

Is there a way to do that?

Thx for your help !

Hi @AlexLamande

All you need to do is log into the appliance and run gem install for the gem you want to use. Then your automate method requires the gem the same way you would in any other ruby script.
(Note: In a multi-appliance environment you need to install the gem on all the appliances that where the automate role is defined.)

For example:

  require "savon"

or if you need a specific version of a gem you could use something like this:

  gem 'savon', '=1.1.0'
  require "savon"

Additional details which may be of interest:
Automate methods run within a Bundler.with_clean_env block which means it does not restrict the gems that can be loaded to those defined by bundler.

You can read more about Bundler.with_clean_env here:

1 Like

Thanks a lot for your help.
I’ll see how to install my gem on the system for each deployment with a chef cookbook.

Also thanks for the details about Bundler.with_clean_env it’ll help me !