Nutanix : Using ansible to download and update NCC on alll you nutanix clusters
If you don’t know Nutanix Cluster Check (NCC), you can read more about it here and here . NCC is one of the most critical tools to detect any problems in your Nutanix platform, so it is important to keep it up to date.
When a new NCC version is released, you need to connect to each Nutanix cluster and upgrade NCC by using either the Prism web console or Life Cycle Manager.
This will be a minimum of 5 clicks and not one click. Say you have 20+ PE clusters and want to update NCC on all clusters, you will spend your entire day clicking.
We need to automate this NCC upgrade task and make day 2 operational easier. OK, so the question now is how do we automate it?
The target solution must be one-liners command and all clusters will be updated with the latest NCC version and for that, no other solution can help us like Ansible.
As you know, Ansible works with a list of hosts in the inventory file. Besides adding one CVM from each cluster, your file will be like this:
[CVM]
CVM1IP
CVM2IP
CVM3IP
CVMnIP
The last step is the creation of a secure password file. It contains the admin password to access the prism element. For that, you can use Ansible Vault.
ansible-vault create cvm_creds.yaml
Below, we have our NCC upgrade Ansible playbook, which is composed of 3 tasks.
All these tasks can be done leveraging rest API calls, this is why we will use the URI module.
The Ansible playbook is available on GitHub repo.
Feel free to modify or suggest any improvements.
Enjoy!