A good approach is to use the data passing feature in this order: 1) create a provide your instance 2) get the new id (maybe via api with your "cloud provider") and 3) use that id for anything.
I leave a basic example/fake job definition to test:
<joblist>
<job>
<context>
<options preserveOrder='true'>
<option name='current_node' value='9272c5fbfdd2ed332592ab565318c55d' />
</options>
</context>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>e7e973aa-987d-40c2-8883-be00191113cd</id>
<loglevel>INFO</loglevel>
<name>CloudJob</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<description>Reprovisioning the instance. Later catch the new id. This step have an log filter attach to get the id and save it on data value (using a regex).</description>
<fileExtension>.sh</fileExtension>
<plugins>
<LogFilter type='key-value-data'>
<config>
<invalidKeyPattern>s|$|{|}|\</invalidKeyPattern>
<logData>true</logData>
<regex>^(id)s*:s*(.+)$</regex>
</config>
</LogFilter>
</plugins>
<script><![CDATA[# reprovisioning simulation
echo "current instance id:@option.current_node@"
echo "provisioning the instance..."
sleep 3
echo "instance reprovisioned..."
# in this part you must caught the new id (maybe via cloud provider api?)
echo "id:9d42d17404ec17b41861879305fd454b" # new id
echo "have a nice day :-)"]]></script>
<scriptargs />
<scriptinterpreter>/bin/bash</scriptinterpreter>
</command>
<command>
<description>now you can do anything with new id (stored at ${data.id} option</description>
<exec>echo "the new id is ${data.id}"</exec>
</command>
</sequence>
<uuid>e7e973aa-987d-40c2-8883-be00191113cd</uuid>
</job>
</joblist>
Here you can see more information about key-value log filter use. And here a good example about data passing feature.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…