ENGINEERING

Using Ansible to Automate OpenNebula

Since we started using the open source cloud platform OpenNebula as our private cloud solution, we struggled to find a simple solution to manage VMs, services and images on it. In the beginning, we had to create instances or manage existing ones manually using the OpenNebula web interface or with some hacky scripts. Because we use Ansible as our main automation platform, we decided to write Ansible modules that will make managing OpenNebula resources a breeze and allow us to make the most of it. Also, given that we’re long-time Ansible users, we wanted to give something back to the community.

After a few months of development and testing, we published: one_vm, one_service, one_image and one_image_facts modules.  We’ve also been using them in production for the past 6 months. And the best thing is that these modules will be part of Ansible, starting with version 2.6. This is the first time that Ansible will include OpenNebula modules.

Let me present to you:

one_vm Module

The module provides the easiest way to manage VM instances in a way to:

  • deploy one or more instances
  • set vm owner, group and permissions
  • terminate, power-off or reboot instances
  • scaling up/down number of instances based on specific attributes and/or labels criteria
  • get instances info

Here are a few examples of how to use the module:

For more details, check out one_vm documentation.

one_service Module

Provides an easier way to manage OpenNebula services, such as:

  • create a service
  • delete a service
  • set service owner, group and permissions
  • change role cardinality
  • get service info

Here are few examples:

For more details, check out one_service documentation.

one_image Module

Provides an easier way to manage OpenNebula images, such as:

  • clone an image
  • rename an image
  • enable/disable an image
  • delete an image

Here is the Ansible documentation.

For more details, check out one_image documentation.

one_image_facts Module

Provides an easier way to gather facts about images using image’s ids, name or a regex pattern.

For more details, check out one_image_facts documentation.

We would also like to mention that Ansible 2.6 will also include the one_host module, which is written by Rafael del Valle (with whom we worked to ensure all modules have a similar design).

Do not hesitate to try them out and tell us what you think. Your feedback and contribution will be much appreciated!

SUBSCRIBE

CATEGORIES