Question

Automate VM categorization based on subnet/VLAN in Nutanix for efficiency

  • 12 December 2023
  • 5 replies
  • 90 views

Badge +1

Hello 
We want to create an automation that any new VM based on its subnet (Vlan) will be automatically added to category. 
How can we do that? 
Thank you
 


This topic has been closed for comments

5 replies

Badge +1

You might be able to tweak this playbook based on the name. I don't see an option for Subnet but there is an option for the Client IP and you could update the regex to match the IP scope for the subnet/vlan maybe. 

https://www.nutanix.dev/playbooks/auto-categorize-new-vms/
playbooks/autocategorize_new_vms/autocat_new_vms.png at master · nutanixdev/playbooks (github.com)

Badge +1

Thank you for the response! I configured it according to the subnet, but it's not working. Did I write it correctly?

 

Badge +1

No you have to write the regex value in a certain way, similar to what you see here https://ihateregex.io/expr/ip/, I think it would be more like

 (^172\.16\.150\.)((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){1}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b

Badge +1

Still not working, thank you for helping me.

The playbook runs, but it's not doing anything on the new machine.(I have tried your regex value and another regex from ChatGPT.)

Is there another way to achieve this automation, maybe with REST API?

 

Userlevel 5
Badge +6

you can use playbook, make sure you have NCM-PRO or Prism-Pro license before using it