Pass Morpheus variables into the Chef bootstrap task

Can we pass morpheus variables to the bootstrap task during deployment of an instance?
I am attempting to pass variables into the chef bootstrap task, and having some issues with the task recognizing that it is a variable. Is this supported?

Example: I have a policy for mandatory environment selection. If I have this as a mandatory item, I want to pass that variable as the environment with a chef bootstrap task. Currently, it is not recognizing it as a variable and attempting to load the variable name itself as the environment and fails.

Let me know if this is possible or if I am missing something.

Can you provide some more context as in

  • Which workflow phase are you executing the Chef Task?
  • Where are you executing the task (local/remote/resource)?

Basically you require 2 things assuming you run the task script locally

  1. Set the variable within your script for example environment="<%= instance.environmentPrefix%>" or if you have a custom field use environment="<%= customOptions.customfieldname%>"
  2. Depending on what you want to do with the environment value, you would be able to leverage this something like

if [[ $environment = “Production” ]]
then
do this

let me know if this helps but depending on your use case it might not be that simple :slight_smile: but happy to share my two cents

Hi @wabbas,

Looking over the Chef Bootstrap task, the environment field in the bootstrap task is not interpreting the variables, as you mentioned. I’d recommend submitting a support case for it as a bug. I did find the “Node Attributes” field does interpret the variables as expected.

Alternatively, you could opt to creating a shell script task (or other language) that would bootstrap the node and set the variable types as you’d want. Another short term idea, you could make a few tasks with the value in it, assign them to different workflows, and choose the appropriate workflow as needed.

Hope that helps!