--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To post to this group, send email to rundeck...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/abc5275b-6af3-4585-8ac6-9c21ba28cb8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[
{"name":"fedora", "value":"fedoras.json"},
{"name":"ubuntus", "value":"ubuntus.json"}
][
{"name":"windowsDesk", "value":"windsk.json"},
{"name":"windowsSrv", "value":"winsrv.json"}
]
[
{"name":"v27","value":"27"},
{"name":"v28", "value":"28"},
{"name":"v29", "value":"29"}
][
{"name":"16.04","value":"16"},
{"name":"17.10", "value":"17"},
{"name":"18.10", "value":"18"}
][
{"name":"Windows 10 Home","value":"win10home"},
{"name":"Windows 10 Pro", "value":"win10pro"},
{"name":"Windows 10 Ultimate", "value":"win10ult"}
][
{"name":"Windows 2016 Core","value":"win2k16core"},
{"name":"Windows 2016 Pro", "value":"win2k16pro"}
]<joblist>
<job>
<context>
<options preserveOrder='true'>
<option enforcedvalues='true' name='VM' required='true' valuesUrl='file:/home/user/Rundeck/v3.0.7/projects/ProjectOPTIONS/DynamicOptions/VM.json' />
<option enforcedvalues='true' name='actions' value='disable' valuesUrl='file:/home/user/Rundeck/v3.0.7/projects/ProjectOPTIONS/DynamicOptions/${option.VM.value}' />
<option enforcedvalues='true' name='port' valuesUrl='file:/home/user/Rundeck/v3.0.7/projects/ProjectOPTIONS/DynamicOptions/${option.actions.value}' />
</options>
</context>
<defaultTab>output</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>1be216bc-7cca-4568-8476-ee770895c68e</id>
<loglevel>INFO</loglevel>
<name>cascading option</name>
<nodeFilterEditable>false</nodeFilterEditable>
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<exec>echo $RD_OPTION_ACTION</exec>
</command>
<command>
<exec>echo $RD_OPTION_VM</exec>
</command>
<command>
<exec>echo $RD_OPTION_PORT</exec>
</command>
</sequence>
<uuid>1be216bc-7cca-4568-8476-ee770895c68e</uuid>
</job>
</joblist>[
{"name":"ps", "value":"prod1.json"}, {"name":"scd", "value":"prod2.json"}][ {"name":"prod-web1","value":"prod-web1"}, {"name":"prod-web2", "value":"prod-web2"}][ {"name":"prod-sa1","value":"prod-sa1"}, {"name":"prod-sa2", "value":"prod-sa2"}][ {"name":"Disable", "value":"disable.json"}, {"name":"Enable", "value":"enable.json"}][ {"name":"443", "value":"443.json"}, {"name":"80", "value":"80.json"}][ {"name":"none", "value":"none"}][ {"name":"pm", "value":"prod1.json"}][ {"name":"scd", "value":"prod2.json"}]Hi Fernando,
Following this message: https://groups.google.com/g/rundeck-discuss/c/5pZza15s_sc/m/5in41OtLHgAJ
I leave this example to test:
<joblist>
<job>
<context>
<options preserveOrder='true'>
<option name='myfile' type='file' />
</options>
</context>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>211ae713-ec3e-479e-bcd3-7870c1c2e20b</id>
<loglevel>INFO</loglevel>
<name>FilenameAsName</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<description>get the filename for debug</description>
<exec>echo ${file.myfile.fileName}</exec>
</command>
<command>
<fileExtension>.sh</fileExtension>
<script><![CDATA[curl -X GET "https://httpbin.org/@file.myfile.fileName@" -H "accept: application/json"]]></script>
<scriptargs />
<scriptinterpreter>/bin/bash</scriptinterpreter>
</command>
</sequence>
<uuid>211ae713-ec3e-479e-bcd3-7870c1c2e20b</uuid>
</job>
</joblist>
Just need a file with “ip” as a name to test successfully.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/b73bbd9a-4bf4-4c5c-ad8a-b4cfc2aaf7d5n%40googlegroups.com.
Hi Fernando,
I see, this is because rundeck won’t know the file name until the job runs, a good way to do that is “build” a URL with that name on any data variable (so, your “remote URL option” is the data variable now).
I leave an example, feel free to modify it if you like.
<joblist>
<job>
<context>
<options preserveOrder='true'>
<option name='myfile' required='true' type='file' />
</options>
</context>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>2cf3872e-30e8-465b-82fd-fcb046c20ba3</id>
<loglevel>INFO</loglevel>
<name>HelloWorld</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<description>build your "url" using that name and storage as data value</description>
<exec>echo "MYURL=https://httpbin.org/${file.myfile.fileName}"</exec>
<plugins>
<LogFilter type='key-value-data'>
<config>
<invalidKeyPattern>\s|\$|\{|\}|\\</invalidKeyPattern>
<logData>true</logData>
<regex>^(MYURL)\s*=\s*(.+)$</regex>
</config>
</LogFilter>
</plugins>
</command>
<command>
<description>Now, you can do anything with that data value.</description>
<fileExtension>.sh</fileExtension>
<script><![CDATA[curl -X GET "@data.MYURL@" -H "accept: application/json"]]></script>
<scriptargs />
<scriptinterpreter>/bin/bash</scriptinterpreter>
</command>
</sequence>
<uuid>2cf3872e-30e8-465b-82fd-fcb046c20ba3</uuid>
</job>
</joblist>
You can learn more about data values here:
https://docs.rundeck.com/docs/manual/log-filters/key-value-data.html#usage
Hope it helps!