With the release of Ansible 2.9, Red Hat will officially be introducing Collections. To quote Red Hat documentation “Collections are a distribution format for Ansible content. They can be used to package and distribute playbooks, roles, modules, and plugins. You can publish and use collections through Ansible Galaxy.” This means that all the NetApp modules and roles will be located in one place to get. As of Ansible 2.10 this will also be the only way to get modules, as Ansible will no longer include modules in its installation.
We will be releasing a series of collections. One for ONTAP, one for Element SW, and one for Santricity. There could be other collections in the future containing different collections of roles for various solutions.
Not only are we ahead of the curve on getting our collections ready with one for ONTAP already available today, but we are one of only five companies that will have certified collections for the 2.9 release. This means even though the method for how you get, add, and update our modules is changing, the strict standards we adhere to are not.
Getting and using collections are easy. If you are still on 2.8, using the application ‘mazer’ is the only way to acquire collections. You may not have mazer installed on your Ansible system so ensure it is there using pip.
#> pip install mazer
Then it’s just a matter of requesting the namespace and collection you want. Our namespace is ‘netapp’ and the first collection is ‘ontap’
#> mazer install netapp.ontap
This will install the NetApp ONTAP collection into ~/.ansible/collections/ansible_collections/netapp/ontap/ so you will want to run the mazer install as whatever user will run Ansible, especially if you are using Tower. As a reminder, you will still need the python module netapp-lib even with collections.
Updating is easy too, you just use the -f option for an update.
#> mazer install netapp.ontap -f
For 2.9 and above ‘ansible-galaxy’ command is used.
#> ansible-galaxy collection install netapp.ontap
This installs to the same location as the mazer does, the running users home directory. If you want to do a more universal installation you can use the -p flag option.
# ansible-galaxy collection install netapp.ontap -p /usr/share/ansible/collections
This path, /usr/share/ansible/collections, is the other default location Ansible will look for collections at.
As you move to collections you will need to make one change to your playbooks. Since the location for all modules is now moving, you can add the namespace.collection call to every task and role you use like this.
na_ontap_volume -> netapp.ontap.na_ontap_volume
However, that is a lot of updates you might have to do. Instead you can just add two lines to the top of your playbook to be sure that you are using the collection.
--- - hosts: localhost collections: - netapp.ontap
Now any roles or modules in that collection can use the standard module and role name you have been using all along.
Go ahead and add the collection to your Ansible environment and let us know what you think. If you have any questions about collections or how NetApp is using them, join us on our Slack channel #configurationmgmt. You can get an invite to the workspace at www.netapp.io/slack.