Execute a remote command after sudo - su anotheruser in Rundeck

Posted by Bera on Super User See other posts from Super User or by Bera
Published on 2012-12-12T20:40:24Z Indexed on 2012/12/12 23:06 UTC
Read the original article Hit count: 913

Filed under:
|
|

I'm new with Rundeck and completely amazed with it and I'm trying to execute a job and my scenario is detailed below:

  • Rundeck is configured with ssh passwordless authentication for user master between node Server (rundeck server) and node Target (remote Solaris host) for user "master"
  • In node Target I want to execute a script /app/acme/stopApp.sh with a user appmanager
  • Normally and manually, when I need to run script above I proceed with

    ssh master@server 
    sudo su - appmanager
    

    or simply

    ssh -t master@server 'sudo su - appmanager'
    

    works without password and finally run (as appmanager)

    /app/acme/stopApp.sh
    

But I'm not sure how can I reproduce these steps using Rundeck. I read in some previous messages that for each job line rundeck use a new ssh connection, so the workflow below always fails for me with the messages:

sudo: no tty present and no askpass program specified
Remote command failed with exit status 1

Please someone could help me with some information to solve this issue.

Without this functionality I wouldn't be able to introduce a little DevOps in my department.

I read the user guide and admin guide but I couldn't find an easy example, neither in this forum, to follow.

© Super User or respective owner

Related posts about ssh

Related posts about sudo