Skip to content
Advertisement

How to pass Rundeck key storage to script

I created Rundeck Key storage and stored password in it

Then created Job option enter image description here

Then in inline script i specified folowing (keys/JIRA is Rundeck password storage)

curl -XN -u user:keys/JIRA

enter image description here

But password is not passed and authnetication fails, what am i doing wrong ?

Advertisement

Answer

The password value will be expanded when it is passed to the script. Below is an example:

- description: ''
  executionEnabled: true
  id: 1f7f5312-0887-4841-a7ef-1c30f712f927
  loglevel: INFO
  name: How to pass Rundeck key storage to script
  nodeFilterEditable: false
  options:
  - name: JiraPass
    secure: true
    storagePath: keys/jira.password
    valueExposed: true
  scheduleEnabled: true
  sequence:
    commands:
    - args: ${option.JiraPass}
      script: |
        #!/usr/bin/env bash

        jira_password=$1
        echo curl -XN -u "user:$1"
    keepgoing: false
    strategy: node-first
  uuid: 1f7f5312-0887-4841-a7ef-1c30f712f927
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement