passing values to a list

Skip to first unread message

Gary Garcia

Apr 5, 2023, 2:19:12 AM4/5/23
to rundeck-discuss
i created a rundeck job that will get the OS name and version from multiple nodes. I can do this by creating a job with a bash script like this...

myosname=`cat /etc/redhat-release |cut -d' ' -f1`
myosversion=`cat /etc/redhat-release |cut -d' ' -f2`
echo "myosname=$myosname"
echo "myosversion=$myosversion"

this works but what I want to do is after the job runs against each node, i want a job that runs against only s specific node that will then update a database record with the os name and version. What I can't seem to understand is how do I pass the myosname and myosversion to a job that runs on another node. I have been trying to make this work using a workflow reference but I just can't seem to make it work. My question is, am i in the right area - i mean with using a job reference?

Apr 5, 2023, 12:07:48 PM4/5/23
to rundeck-discuss
Hi Gary,

Let me share my approach. I created a couple of jobs:

1. The first one (ScriptJob) takes the OS info from node00 and node01 and saves them on data variables (I used a output filter to create the data variables).

2) The second job (Reporter) uses three options to receive this from the first job: a) the node name, b) the os name, and c) the OS version. This job uses this info to put them on the node02.

So an essential part of the first job is to call the second one as a referenced job and then pass the data/node info to the second job options as an argument.

Check the result.

Attached I left the job definition examples to test, (you need to change the remote node filter of course).

Hope it helps!

Gary Garcia

Apr 6, 2023, 12:52:20 AM4/6/23
to rundeck-discuss
Wow! that worked perfectly.
Thank you and I Love Rundeck!

Apr 6, 2023, 10:36:48 AM4/6/23
to rundeck-discuss
Good news then! cheers!
Reply all
Reply to author
0 new messages