Ansible Collections
We briefly touched on ansible galaxy collections, but here we’ll get into a little more detail. We’ll install a collection using a workflow similar to being in a disconnected environment. Take a look at collections/requirements.yml in the top of the workshop directory. This defines a collection that we want to install.
Download the collection.
This creates a local tar file based on the contents of the requirement.yml file in the collections directory. This step would be performed on an Internet facing systems and the results would be transferred to the disconnected environment.
Now we’ll view the download, install the collection and validate it’s installed.
View the available documentation for all of the Nutanix modules included in the collection.
Next view the documentation for creating a Nutanix VM.
Using the Nutanix collection would require that you have access to the credentials to hit the Nutanix API, which is beyond the scope of this workshop. However, let’s review the vm.yml playbook.
- lines 5 and 6 make the collection modules available in the playbook.
- lines 7 - 12 set the variables for API access. This would be held in a vault encrypted file for sure.
- the first task sets some variables that will be used in the playbook
- the second task creates the VM defining characteristics such as image, CPU, etc.
- the final module outputs some details about the VM that was just created