Rundeck argument to job can't use ${node.osVersion} but ${node.consulagent} works?

31 views
Skip to first unread message

Gary Garcia

unread,
Apr 22, 2022, 12:33:29 PM4/22/22
to rundeck-discuss
here one of the node resources configured...

  <node name="agileappdev2.ussl.uhs" description="" tags="" hostname="agileappdev2.ussl.uhs" osArch="" osFamily="Linux" osName="Red Hat Enterprise Linux " osVersion="6.7" username="svc-ansible">
    <attribute name="datacenter" value="slc"/>
    <attribute name="environment" value="dev"/>
   </node>

when i add an argument to a inline script job with 
job argument: ${node.datacenter} 

then in the inline script...

mydc=$1

echo $mydc
slc

the above works.
but if i try to use one of those in the tags... like this...
job argument: ${node.osVersion}

myversion=$1

echo $myversion

when the job runs, no output from the "echo $myversion". anyone know if i'm supposed to be using something other than ${node.osVersion} like ${tag.osVersion} ?

Thank you in advance for any help


rac...@rundeck.com

unread,
Apr 22, 2022, 1:04:36 PM4/22/22
to rundeck-discuss

Hi!

The context variable name for the OsVersion attribute is ${node.os-version} let me share with you a job definition example:

- defaultTab: nodes
  description: ''
  executionEnabled: true
  id: 3d0fc24a-48f5-4de6-867a-78ee74b43a1d
  loglevel: INFO
  name: ModelSourcePropertiesExample
  nodeFilterEditable: false
  plugins:
    ExecutionLifecycle: null
  scheduleEnabled: true
  sequence:
    commands:
    - exec: echo "starting"
    - args: ${node.os-version}
      fileExtension: .sh
      interpreterArgsQuoted: false
      script: |+
        myarch=$1
        echo "Node Version: $myarch";

      scriptInterpreter: /bin/bash
    keepgoing: false
    strategy: node-first
  uuid: 3d0fc24a-48f5-4de6-867a-78ee74b43a1d

Here you can see all context variables. And here is the result.

Hope it helps!

Gary Garcia

unread,
Apr 22, 2022, 1:13:57 PM4/22/22
to rundeck-discuss
That worked! you are a genius! you just saved me so much work! 
Thank you!
Gary

rac...@rundeck.com

unread,
Apr 22, 2022, 1:51:02 PM4/22/22
to rundeck-discuss
Happy to help! :-)
Reply all
Reply to author
Forward
0 new messages