When it comes to managing a fleet of Linux boxes with minimal extra infrastructure, I am a fan of Ansible. I have written before about using PowerShell to automate working with Cohesity, that will be a good choice for vSphere and Hyper-V environments where PowerShell is the native automation platform. I have also shown how the AutoProtection feature on Cohesity allows newly created VMs to be protected based on folders, tags, or naming. But what about when you have a bunch of physical Linux boxes that you want to protect? Ansible seems a great fit, and happily, Cohesity has an Ansible role to make everything easy. Here, I look at deploying the role and retrieving information about your Cohesity cluster using the Cohesity facts function. The video of me following this process is right here if you would prefer not to read any further.
Disclosure: This post is part of my work with Cohesity.
I’m going to assume that you already have a management workstation with Ansible (2.6 or higher) and Python (also 2.6 or higher) installed. The Cohesity role installation is a single command:
ansible-galaxy install cohesity.cohesity_ansible_role
I added an entry to my default Ansible inventory file in /etc/ansible/hosts that identifies my Cohesity cluster by its virtual IP address. I don’t think that the sample playbooks use this as they have variables for the Cohesity cluster inside the playbook.
One of the sample playbooks provided by Cohesity is called Cohesity Facts, and retrieves a vast amount of information from your Cohesity Cluster. I updated the sample playbook with my cluster virtual IP address and credentials.
Then I ran the playbook, which retrieved a lot of data from the cluster and wrote that out to a JSON file on the local machine.
I won’t include the details of the data returned here; there is a lot of information. All the cluster configuration details, as well as storage, policies, protection jobs, and protection runs are there. Being JSON formatted, this data is relatively easy to re-use in your automation or as documentation.
Now that we have set up the Ansible role, it is time for me to build some physical Linux boxes to protect. Stay tuned for the next video where I should be able to use Ansible push out the Cohesity agent and start protecting those physical Linux servers.
© 2020, Alastair. All rights reserved.