Rundeck - Cascading Options Display json filename rather than content

108 views
Skip to first unread message

jumah35

unread,
Aug 30, 2019, 11:31:49 AM8/30/19
to rundeck-discuss
Hi,

I followed the topic below :

Working great in rundeck , until I need to transmit options to Ansible through extra variables. 
In ansible , the file name is transmit rather than the content selected during the cascading process.

Maybe something wrong ? Any idea to solve my issue ? 

Thanks in advance for your help.


Regards

Ju


Below my config :
** Rundeck Job definition
<option enforcedvalues='true' name='leaf_id' valuesUrl='file:/root/ansible/playbooks/My_playbooks/cascading_options/${option.site.value}/${option.interface_type.value}'>
<label>Leaf :</label>
</option>

** Json Cascading File (valuesUrl)
interface_type.json
[
{"name":"switch_port", "value":"leaf.json"},
{"name":"vpc", "value":"leaf_vpc.json"}
]
interface.json
[
{"name":"101", "value":"interface.json"},
{"name":"102", "value":"interface.json"}
]

** Result during prepare and run 

2019-08-30_17h16_06.png


** Rundeck - Ansible Job Step

Extra variables used 

-e "leaf_id=${option.leaf_id} interface_type=${option.interface_type}"


** Ansible Playbook

- name: Summary
debug :
msg:
- "Interface Mode {{ interface_mode }}"
- "Interface Type {{ interface_type }}"
- "Leaf {{ leaf_id }}"
- "Interface {{ interface }}"



** Ansible Result 

TASK [Summary] *****************************************************************

ok:  => (item=Vlan 4) => {

    "msg": [

        "Interface Mode trunk", 

        "Interface Type leaf.json",        !!!!!!! Display Json Filename rather than expected result : switch_port

        "Leaf  interface.json",              !!!!!!! Display Json Filename rather than expected result : 101 

        "Interface 1/1"

    ]

}



Reiner Acuña

unread,
Sep 4, 2019, 2:55:32 PM9/4/19
to rundeck-discuss
Hello Julien,

I reproduces your issue, is not related with ansible plugin is related with the way of rundeck catch the dynamic options (in depth, the file name is the real value of your cascade json and is a expected behavior), anyway sounds good for enhancement request (as always please suggest it here: https://github.com/rundeck/rundeck/issues).

Maybe a good solution is to create some script that deduce the previous options based on final result.

Here how to reproduce it.

Job definition:

<joblist>
 
<job>
   
<context>
     
<options preserveOrder='true'>
       
<option enforcedvalues='true' name='transport' valuesUrl='file:/home/user/transport.json' />
       
<option enforcedvalues='true' name='vehicle' valuesUrl='file:/home/user/${option.transport.value}' />
     
</options>
   
</context>
   
<defaultTab>summary</defaultTab>
   
<description></description>
   
<executionEnabled>true</executionEnabled>
   
<id>aa888ae8-c414-4dd9-9e01-26e17addb788</id>
   
<loglevel>INFO</loglevel>
   
<name>Cascade</name>
   
<nodeFilterEditable>false</nodeFilterEditable>
   
<scheduleEnabled>true</scheduleEnabled>
   
<sequence keepgoing='false' strategy='node-first'>
     
<command>
       
<exec>echo ${option.transport}</exec>
     
</command>
     
<command>
       
<exec>echo ${option.vehicle}</exec>
     
</command>
   
</sequence>
   
<uuid>aa888ae8-c414-4dd9-9e01-26e17addb788</uuid>
 
</job>
</joblist>

transport.json

[
   
{"name":"cars", "value":"cars.json"},
   
{"name":"motorcycles",  "value":"motorcycles.json"}
]


cars.json

[
 
{"name":"bmw", "value":"bmw"},
 
{"name":"fiat", "value":"fiat"}
]


motorcycles.json

[
   
{"name":"honda", "value":"honda"},
   
{"name":"yamaha",  "value":"yamaha"}
]

Regards!

jumah35

unread,
Sep 5, 2019, 3:17:43 AM9/5/19
to rundeck-discuss
Thank you Reiner for your time. 
As you suggested, I'm gonna use a script to properly set the expected result.

Best regards,
Ju
Reply all
Reply to author
Forward
0 new messages