Automation and Configuration Management are indispensable to an efficient DevOps driven environment. NetApp has supported Ansible modules for ONTAP and Element software. So, let’s get right to it and see how all this works!
Update NetApp Modules
Occasionally, there will be updates to the NetApp modules ahead of the full releases of Ansible. These updates can be bug fixes, new modules, new features, etc. I know you are going to want to take advantage of these new modules as soon as possible, so here is how to update to the newest options from NetApp.
As usual, I am using CentOS 7.5 for my environment.
The first thing that is needed is an application called ‘git’. Git is a distributed version control and Source Code Management (SCM) utility.
$ sudo yum install git -y
Once that is installed it is used to download the most current development version of Ansible from the official Ansible Github repo. I like to download mine to my home directory, but you can put yours where ever you want.
$ git clone https://github.com/ansible/ansible.git ~/ansible-devel
This created a directory called ‘ansible-devel’ in my home directory that contains all the current files for the next version of Ansible. If I keep this directory, git allows me to use it in a special way that will allow me to automatically download only updated files in the future. This is done with a
git pull as in the example.
$ cd ~/ansible-devel $ git pull
Whether this was the first time we downloaded the files with a clone, or we just updated with a pull, we need to copy these files to our Ansible modules directory. You find your environments directory using the
ansible --version command.
$ ansible --version ansible 2.7.0 config file = None configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Line 5 above is the important one. It says ‘ansible python module location = /usr/lib/python2.7/site-packages/ansible’. Your line may be slightly different based on the distribution of Linux. The /usr/lib/python2.7/site-packages/ansible directory is where the two important directories we will copy files into are located. These directories are called ‘module_utils’ and ‘modules’. The new modules will be copied into these locations. In the example below, be sure to use the path that is after your ‘ansible python module location’.
$ cd ~/ansible-devel/lib/ansible $ sudo yes|cp -aRv module_utils/netapp* /usr/lib/python2.7/site-packages/ansible/module_utils $ sudo yes|cp -aRv modules/storage/netapp/* /usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/
This will copy all modules and their utilities to your environments working directory for Ansible modules.
That’s it, you just updated your modules between major Ansible releases. If there has been a major release and you followed the Getting Started guide you can update with this command.
$ sudo pip install ansible --upgrade
Join me next Getting Started, to learn the basics about playbooks.
If you have any questions or comments join me on our Slack workspace in the #configurationmgmt channel. Also, keep an eye on netapp.io for all new information on what we are doing around Ansible.
You can see a video demonstration of these steps here.