Introduction
Nutanix X-Play (pronounced CrossPlay) is a simple low-code, no-code automation tool built into Nutanix Prism that allows you to automate routine tasks, by defining a trigger and a set of actions that should be carried out when the trigger is fired. If you are familiar with IFTTT, it’s essentially what X-Play is, but for Nutanix. For example, you can set up playbooks to do the following:
- Add memory to a constrained VM when a particular alert is detected
- Add a new VM to your configuration management tool after a VM is created
- Run a series of tasks on a VM manually
Setting up a playbook is a simple 3-step process:
- Define a trigger
- Define one or more actions that should occur
- Save and enable the playbook
As of Prism Central version pc.2021.9, there are 6 triggers that can be defined:
- Alert – Trigger the playbook when a certain alert is generated
- Alerts Matching Criteria – Trigger the playbook on any alert matching specific criteria, for example, all alerts on a specific entity
- Event – Trigger Playbook when a certain event is generated (for example, a VM is created, a node is added, etc)
- Manual – Trigger playbook manually for a VM, host, or cluster. This is useful for running a series of tasks in one click. For example, you could create a playbook that can power off a VM, increase certain resources, power on the VM, and then run a script on the VM, all with a single click.
- Time – Trigger the playbook at a specific time, useful for scheduling your automation tasks (like a cronjob). For example, this could be used to power cycle a specific VM on a regular schedule.
- Webhook – Trigger the playbook by calling an endpoint via HTTP POST. This allows you to trigger playbooks from any external tool.
There are 30+ actions that can be used to construct a playbook. The actions and their pre-requisites are documented in the Prism Central guide. Examples of actions include:
- Adding or reducing resources on a VM
- Adding a VM, host or cluster to a specific category
- Running SSH/Powershell commands or scripts on a VM
- Generating reports
- Sending messages to Slack or Microsoft Teams
- Triggering an Ansible workflow or job template
- Sending an alert to ServiceNow
- Make a REST API call
There are many actions that allow native integration with 3rd party tools such as Slack, Microsoft Teams, Ansible, and ServiceNow. If there is any tool that is not supported natively, you can create your own actions by cloning the REST API action, which can be used to make API calls to essentially anything.
We are adding actions all the time, so check back in future releases to see what new actions have been added!
Resources
We have a lot of useful content already created. Here are some great resources to get started with!
Playbook Library: https://www.nutanix.dev/playbooks/
Playbooks can be exported as a .pbk file and imported into other instances. We have a playbook library right here on nutanix.dev where you can get started with some pre-built playbooks in your environment!
[Blog/Video] Top 10 Playbooks to get started: https://next.nutanix.com/community-blog-154/top-ten-useful-playbooks-to-get-started-with-aiops-in-prism-39812
This blog gives great examples of what can be automated with X-Play. It also has links to short video clips from the Smart IT Ops Automated YouTube channel that go through demos of the different triggers and actions.
[Video] Automated Remediation With X-Play: https://www.youtube.com/watch?v=xMLrALGPHZ4
This demo uses the Alert trigger to add memory to a VM when a specific alert is detected. It also does the following:
- Snapshots the VM
- Resolves the Alert
- Sends an e-mail to the admin to indicate that the VM memory was increased
[Video] New Playbook Actions in Nutanix X-Play PC.2021.7: https://www.youtube.com/watch?v=q4HFcGMO11Q
This demo illustrates 4 new actions in Nutanix X-Play introduced in pc.2021.7: Add to Category, Ansible, Microsoft Teams, Remove from Category
This demo uses the Event trigger so that when a VM is created, a series of actions is performed:
- The VM is powered on
- An API call is made to Ansible to add the VM to Ansible inventory
- The VM is added to a specific category
- An Ansible job is run
- A Microsoft Teams message is sent
It also creates a second playbook using the Event trigger so that when a VM is updated, it is removed from a category if required (based on the VM name).
[Video] Nutanix X-Play and ServiceNow Integration: https://www.youtube.com/watch?v=SbFbIuFv5xc
This demo shows how to use Nutanix X-Play and the ServiceNow Flow Designer to allow ServiceNow to receive and respond to Nutanix alerts.
This demo creates two playbooks, one using the Alert trigger and one using the Webhook trigger.
The first playbook with the Alert trigger uses the built-in Send Alert to ServiceNow action, which will send the alert to ServiceNow as an incident. The second playbook with the Webhook trigger uses the VM Add Memory action.
Once ServiceNow receives the alert from the first playbook, it goes through an automation process that eventually calls back into Prism by calling the second playbook.
For more information, please see the following Tech Note: https://portal.nutanix.com/page/documents/solutions/details?targetId=TN-2123-Alert-Remediation-with-X-Play-ServiceNow%3ATN-2123-Alert-Remediation-with-X-Play-ServiceNow
[Video] Automate Security with Nutanix Era, X-Play, and Flow: https://www.youtube.com/watch?v=-gnGYFeAHMc
This demo shows how to automatically add a database VM to a specific category after it has been provisioned with Nutanix Era.
This demo uses the Webhook trigger and the “Add to Category” action.
In Nutanix Era, you can run scripts that run before and/or after the DB is provisioned. In this demo, a post create script makes a REST API call to the webhook to trigger the playbook once the DB is provisioned.
Try it Out!
Try playbooks out for yourself by checking out our AIOps & Automation Test Drive: https://www.nutanix.com/testdrive?type=tdops