(I have tried to use a playbook, but it's not working.)
Page 1 / 1
Hi nivlev,
You can accomplish this with playbooks. Attaching an example, save the code snippet with .pbk extension and import it into your PC instance. For future inspirations, please don’t hesitate to visit our playbook library.
{
"pcVersion": "2023.3",
"pcUuid": "667976da-ef32-4d13-b213-41ee98566b33",
"hashValue": "z5T8FVrlyRMGp78sfHBFRKRQ+hBdhZdIGoT1gSv4+BM=",
"actionRuleList": :
{
"uuid": "6b03ebe3-4bf4-4b5a-ab61-f3b2cf6e5b94",
"name": "vlan-to-category",
"isEnabled": false,
"validated": false,
"triggerList": :
{
"uuid": "ffb6064c-8a86-4557-8431-2d722c7b05fb",
"triggerType": {
"type": "trigger_type",
"uuid": "",
"name": "event_trigger"
},
"displayName": "Event",
"inputParameterList": :
{
"name": "operation_type",
"value": "1"
},
{
"name": "category_filter_list",
"value": " ]"
},
{
"name": "type",
"value": "VmCreateAudit"
},
{
"name": "source_entity_info_list",
"value": " ]"
}
]
}
],
"actionList": :
{
"uuid": "4b68c997-96e1-43b3-aaea-045e6ea03964",
"actionType": {
"type": "action_type",
"uuid": "",
"name": "wait_for_duration"
},
"displayName": "Wait for Some Time",
"inputParameterList": :
{
"name": "block_resume",
"value": "false"
},
{
"name": "post_check_trigger_validity",
"value": "false"
},
{
"name": "stop_after_time",
"value": "false"
},
{
"name": "wait_duration",
"value": "2"
}
],
"maxRetries": 2,
"postCheckTriggerValidity": false,
"childActionUuids": :
"ead4bbb9-9d9a-413a-8468-3d9d81f36cb4"
]
},
{
"uuid": "ead4bbb9-9d9a-413a-8468-3d9d81f36cb4",
"actionType": {
"type": "action_type",
"uuid": "",
"name": "rest_api_action"
},
"displayName": "REST API",
"inputParameterList": :
{
"name": "auth_type",
"value": "basic_auth"
},
{
"name": "headers",
"value": "Content-Type:application/json"
},
{
"name": "username",
"value": "admin"
},
{
"name": "url",
"value": "https://localhost:9440/api/nutanix/v3/vms/{{triggere0].source_entity_info.uuid}}"
},
{
"name": "method",
"value": "GET"
}
],
"maxRetries": 2,
"childActionUuids": :
"04d2bfd4-9df7-4578-a719-6bbf1870ab20"
]
},
{
"uuid": "04d2bfd4-9df7-4578-a719-6bbf1870ab20",
"actionType": {
"type": "action_type",
"uuid": "",
"name": "parse_action"
},
"displayName": "String Parser",
"inputParameterList": :
{
"name": "json_path",
"value": "$.status.resources.nic_lists0].subnet_reference.name"
},
{
"name": "string_to_parse",
"value": "{{actiono1].response_body}}"
},
{
"name": "format",
"value": "json"
}
],
"maxRetries": 2,
"childActionUuids": :
"c38a0440-61d4-4845-9b24-561ed7cdd654"
]
},
{
"uuid": "c38a0440-61d4-4845-9b24-561ed7cdd654",
"actionType": {
"type": "action_type",
"uuid": "",
"name": "branch_action"
},
"displayName": "Branch",
"inputParameterList": :
{
"name": "values",
"value": " \"{{actiono2].parsed_data}}\",\"SubnetDev\",\"{{actiono2].parsed_data}}\",\"SubnetProd\",\"{{actiono2].parsed_data}}\",\"SubnetTest\"]"
},
{
"name": "condition",
"value": " \"if\",\"if\",\"if\"]"
},
{
"name": "branch",
"value": " \"0ea5173d-839b-4b73-9614-af6b55fe5c32\",\"9de624c6-2493-4059-9cb1-e19eaef2d172\",\"b1000385-c6cc-42cc-86da-349bf7aa033e\"]"
},
{
"name": "conditional_expression",
"value": " \"{0}=={1}\",\"{2}=={3}\",\"{4}=={5}\"]"
}
],
"maxRetries": 2,
"description": "@|@|",
"childActionUuids": :
"0ea5173d-839b-4b73-9614-af6b55fe5c32",
"9de624c6-2493-4059-9cb1-e19eaef2d172",
"b1000385-c6cc-42cc-86da-349bf7aa033e"
]
},
{
"uuid": "0ea5173d-839b-4b73-9614-af6b55fe5c32",
"actionType": {
"type": "action_type",
"uuid": "",
"name": "add_category_action"
},
"displayName": "Add to Category",
"inputParameterList": :
{
"name": "target_vm",
"value": "{{triggere0].source_entity_info}}"
},
{
"name": "category_entity_info",
"value": " ]"
},
{
"name": "entity_type",
"value": "vm"
}
],
"maxRetries": 2
},
{
"uuid": "9de624c6-2493-4059-9cb1-e19eaef2d172",
"actionType": {
"type": "action_type",
"uuid": "",
"name": "add_category_action"
},
"displayName": "Add to Category",
"inputParameterList": :
{
"name": "target_vm",
"value": "{{triggere0].source_entity_info}}"
},
{
"name": "category_entity_info",
"value": " ]"
},
{
"name": "entity_type",
"value": "vm"
}
],
"maxRetries": 2,
"description": "Copy 1"
},
{
"uuid": "b1000385-c6cc-42cc-86da-349bf7aa033e",
"actionType": {
"type": "action_type",
"uuid": "",
"name": "add_category_action"
},
"displayName": "Add to Category",
"inputParameterList": :
{
"name": "target_vm",
"value": "{{triggere0].source_entity_info}}"
},
{
"name": "category_entity_info",
"value": " ]"
},
{
"name": "entity_type",
"value": "vm"
}
],
"maxRetries": 2,
"description": "Copy 2"
}
],
"validationErrorList": :
{
"componentType": "action",
"componentName": "rest_api_action",
"instanceUuid": "ead4bbb9-9d9a-413a-8468-3d9d81f36cb4",
"parameterErrorList": :
{
"parameterName": "password",
"errorObject": {
"errorMsg": "Required field %s is missing",
"paramList": :
"Password"
]
}
}
]
}
],
"isPrepackaged": false,
"checkTriggerValidity": true,
"triggerFilterableInputParamName": "type",
"triggerFilterableInputParamValue": "VmCreateAudit",
"ruleType": "kXPlay",
"isUserSpecificValidationError": false
}
]
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.