Morpheus 5.4.3 Ansible Enhancements

By: Morpheus Data

Ansible is a popular open-source automation and orchestration tool. The Morpheus platform natively integrates with the open-source Ansible engine as well as the Ansible Automation controller (formerly known as Ansible Tower). The 5.4.3 release of the Morpheus platform includes several enhancements to the Ansible integration.

Simplified Playbook Variable Injection

This release adds the ability to pass Morpheus variables to a playbook without the need to define the Morpheus variables in the Ansible playbook itself. This makes working with Ansible playbooks a simpler and more consistent experience when developing and testing playbooks from a local machine. If we look at the following example we can see how simple it is to use this feature. The playbook expects a variable for the MongoDB version.

- hosts: all
gather_facts: true

- name: Include the mongodb role
name: mongodb
mongodb_version: "{{ mongodb_version }}"

The ansible-playbook command supports defining variables at the command line. To use this feature the --extra-vars flag is added to the COMMAND OPTIONS field in the Ansible playbook task with the variables defined as key value pairs (key=value). The value of the Ansible variable is the Morpheus input/option using the Morpheus Ansible variable format. In this case we’ve created an input or option type in the Morpheus platform with the field name mongodb_version.

--extra-vars "mongodb_version={{ morpheus['customOptions']['mongodb_version'] }}"
Morpheus ansible playbook variable injection

Git Repository Caching

The Morpheus Ansible integration supports dynamically fetching Ansible code from source control. The code is fetched from source control prior to every playbook execution to ensure the latest code is used. This works well in most situations, but there are scenarios where the constant polling of the source control system creates an issue. This where the git repository caching feature becomes useful. Morpheus will cache the repository for a default period of 5 minutes and will check for new code once the cache has expired.

Enable git repository caching on an Ansible integration by checking the ENABLE GIT REPOSITORY CACHING checkbox.

Ansible Collections Support

Ansible collections are the new Ansible content packaging format introduced in Ansible engine 2.9. A collection can include playbooks, roles, modules, and plugins. The 5.4.3 release of the Morpheus platform adds native support for installing Ansible collections. Add the collection to the requirements.yml dependency file in the git repository to use a collection. The example below displays adding a role as well as a collection via the requirements.yml dependency file.

# Install a role from Ansible Galaxy.
- name:
version: 1.9.6

# Install a collection from Ansible Galaxy.
- name: geerlingguy.php_roles
version: 0.9.3


The Ansible integration in the Morpheus platform enables organizations to execute Ansible playbooks at scale. And, the 5.4.3 release of the Morpheus platform improves upon this capability with the addition of variable injection, git repository caching, and collections support.

Try Morpheus Community Edition or Get a Demo
The Morpheus Community Edition lets you fully experience the Morpheus platform including nearly all features and capabilities! Register at Morpheus Hub and try it in your home lab or test environment today! Interested in learning more about Morpheus from one of our cloud transformation experts? Schedule a demo to walk through how Morpheus can help your organization here.

Related Resources

  • listing image
    Feb 2024 | Blog
    Reduce risk from the Broadcom acquisition with VMware a...
  • card listing image
    Nov 2023 | Video Demo
    The Morpheus Plugin Code Generator
  • card listing image
    Oct 2023 | Video Demo
    Morpheus Minute: Workflows
  • card listing image
    Oct 2023 | Webinar
    Tech Brief: Morpheus & Ansible Automation Platform
  • card listing image
    Oct 2023 | Webinar
    Tech Brief: Getting Started with Morpheus REST API
  • listing image
    Sep 2023 | Paper
    Terraform Integration with Morpheus Cloud Management
  • listing image
    Sep 2023 | Paper
    Morpheus Features Mapped to Gartner Cloud Tooling Crite...
  • listing image
    Sep 2023 | Solution
    Morpheus + HPE Solution Brief
  • listing image
    Sep 2023 | Solution
    Morpheus Business Value Solution Brief
  • listing image
    Sep 2023 | Solution
    Morpheus + Dell Solution Brief