I am very new to Automation Tasks and need some pointers. I would like to grab an Instances tag key and use that in a powershell script task in morpheus. I have already read through the documentation regarding script variables but I may have missed something. I do not see anything for an instances tag as a script variable.
Server abc123 has a tag that was assigned at provisioning of “Support Team: Admin group 1”.
So a bit confusing in this realm because of backwards compatibility. instance.tags is the Labels functionality in Morpheus. Long ago was called tags, prior to cloud tags really being a thing. That said, cloud tags are instance.metadata.
If you are doing a bash script to echo, assuming you have jq installed you can run this as context local (so runs on Morpheus) but against another server.
The encodeAsJson() isn’t always necissary, but the variable formatting is Groovy based and I wanted to ensure the data I got was JSON and not a list.
Also, note that the quoting around our variables isn’t actually required, but it inputs the variables as strings. So you need to be aware of what the Morpheus variable will output. Since JSON is double quotes " I wrapped the variable in single quotes to avoid any oddities when running my script.