Ansible Content Collections for Pure Storage

Learn how to modify your existing Ansible playbooks that use upstream Pure Storage® modules for FlashArray™ or FlashBlade™ so you can use Ansible®  Content Collections.


image_pdfimage_print

In the second post in this series, we’ll look at a real-world example of using Ansible modules to perform a frequently used process. I’ll also cover some of the new features in the FlashArray Collection that can be used to assist in the most painful of storage administration tasks – migrating data from one array to another.


Ansible Collections combine playbooks, plugins, roles, and modules to improve flexibility and scalability. Backed with Pure’s simple and highly scalable storage backends, the Ansible Collections can help automate and further simplify your private or hybrid cloud environments.

A little bit of history. You may have noticed, Red Hat® announced significant changes to Ansible’s structure at Ansible Fest in Atlanta last September. 

Red Hat calls this change a New World Order, because it dramatically changes the way third parties will contribute code –  specifically roles, plugins, and modules – to Ansible. In future releases of Ansible, only the core modules created by the Ansible community and all third party modules will be removed, making Ansible easier to maintain from Red Hat’s perspective.

What does this mean for third party modules, including those from Pure, that already exist upstream in  Ansible? How will users be able to access the functionality these modules provide?

The change in Ansible will allow third-party providers, like Pure, to release new feature and functionality support (and provide bugfixes) quicker, because the future deployment mechanism does not tie providers into the Ansible release cycle.

What is the new deployment mechanism, and how does it work?

The new deployment method is called Ansible Content Collections. It can be used from Ansible 2.9, which is when  Red Hat will remove all third-party contributions. In Ansible 2.10, Collections will be the only way to get integration support for third-party solutions, such as FlashArray and FlashBlade.

Pure is pleased to announce that it has been approved as a Content Collection provider for Red Hat’s new Ansible platform, Automation Hub. Links to our collections are already provided in Automation Hub

Redhat Ansible Content Collections

So what do you get from Collections that you don’t get from the current upstream modules in Ansible? Simply put, the FlashArray and FlashBlade Collections will include all the existing upstream modules and any future modules. Upstream modules from  Pure will therefore no longer be added, and only bugfixes will be applied to existing modules.

Available now, new modules in the Pure Storage Collections are in the Ansible Automation Platform and Ansible 2.9. These include support for ActiveCluster, a new major feature in Pure’s synchronous replication functionality for FlashArray.

So how do you enable and install Pure’s Collections in your Ansible environment, and how do you ensure your existing playbooks use these Collections?

The primary prerequisite is that you are running Ansible 2.9.0 or higher. That’s it. Simple.

Once you have the correct version of Ansible, you can install any Collection with this simple command:

To install the Pure Storage FlashArray Collection, use the command:

With the Pure Storage FlashArray Collection installed, how do you make sure that your current or new playbooks use the Collection instead of existing upstream modules? (Don’t forget, they will not be available in the future, so it is worth migrating to Collections as soon as they are made available).

It’s straightforward to use a Collection. You can change every reference to a module included in a Collection to reference it’s fully qualified Collection name like this:

Calling the purefa_host module from the installed FlashArray Collection is:

If you have a very long and complex playbook, this might be a little time-consuming. To avoid all the typing, add the collections keyword to your playbook, where you can define all the collections you are referencing in subsequent plays. Here, for example, we are telling the playbook to use both the FlashArray and FlashBlade Collections for subsequent plays.

If a play exists in one of the defined Collections, then it will be used by the playbook. If it doesn’t exist, Ansible will look for it in the upstream modules and use that version.

If you are using Ansible roles and want to convert these to use Collections, you must add the collections keyword into the file meta/main.yml in each role. This file will look something like this:

As mentioned above, the Collections deployment method allows third-party providers to release new features faster. This is already the case for both the FlashArray and FlashBlade Collections. A major release for FlashArray now enables ActiveCluster automation using the Ansible playbook.

See all Pure Collections for Ansible .

flash array test drive

Written By: