So lately while automating some jobs with Rundeck I came across a problem:
/tmp/11637-10898-rundeck.***-dispatch-script.tmp.sh: /var/lib/rundeck/workspaces/f86853fb-a1e1-4517-bad8-a17931726d00/10898/ some-directory/ansible-playbooks/some-other-directory/plays/ virtual-env-directory/bin/pip: bad interpreter: Permission denied
Wow, where did it come from?
This pip command works perfectly from the CLI. So why under Rundeck it fails?
So I found out, that this is due to shebang length limitation. On Linux it just can't be longer than 128 characters (see BINPRM_BUF_SIZE here).
And Rundeck changes this path a bit (this is due to job configuration I use).
So as I didn't want to recompile my Kernel for that to make it work I simply made sure that the whole shebang would fit the 128 chars limit by shortening the path mentioned in error above.
There's also another way - one could create a wrapper script that would run the original one and run it via exec command.
You can read about it more here: