Search code examples
rundeck

Rundeck - Get in the script the username who executed the job


I would like to know if there is a way to get the username who executed the job and use it in the job which has been executed ?

If my question isn't clear, here is an example :

An user 'bobby' connects to rundeck and execute the job 'lets_go_to_the_moon' In the job 'lets_go_to_the_moon' I want to get 'bobby' in a variable and use it to store this information in a database for example.

Ps : I know that this information can be retrieve in the database dedicated to rundeck, but is there a native variable dedicated to get this kind of information ? And if yes, how ?

Thank you guys, Happy day !


Solution

  • You can use job.username context variable.

    Command step format: ${job.username}

    Inline-script format: @job.username@

    "External" script format: $RD_JOB_USERNAME

    If you are dispatching an "external" script to a remote node, take a look at this.

    Here you can see all rundeck context variables.