1

I have a shell script which I would like to pass two arguments. The script accepts a hostname($1) and a directory name($2) as arguments

just_pull.sh HOSTNAME CONFIG_DIR

I have created a simple Rundeck job to run this script when the Webhook is called. I have gone through the documentation and it does not provide a way to do this as I am new to rundeck and its web API's. Passing the JSON value to the URL also throws a null value. I believe I am sending or receiving the data in an improper manner.

How can I define the arguments section in job and how to correctly add the {option.hostname} in Webhook arguments section.

DMJoh
  • 43
  • 7

2 Answers2

2

Thanks @MegaDrive68k for the answer.

To elaborate the answer to my question,

I had to modify the job also. The 'Argument' section has to be filled with, ${option.hostname} ${option.conf}

Additionally the webhook should have -hostname ${data.field1} -conf ${data.field2} as 'Options'.

To call the Webhook, run the following command,

curl -H "Content-Type: application/json" -X POST -d '{"field1" : "localhost", "field2" : "conf"}'  http://rundeckurl.com/api/38/webhook/aZmoByl0Hmasked8RkxBT8Oda#webhookname

The above command will pass the arguments to my script in question as,

just_pull.sh localhost conf
DMJoh
  • 43
  • 7
  • All the tickets on the rundeck github page have ruined formatting, this is the only answer that shows how Options are supposed to be formatted. – DustWolf Jun 20 '22 at 12:51
1

In this way. Basically you need to define the argument on the "Options" field (Webhook definition).

MegaDrive68k
  • 3,768
  • 2
  • 9
  • 51