Skip to content

Adding and using remote hosts in Dagobah

Travis Thieman edited this page Jun 17, 2014 · 4 revisions

Thanks to recent changes, Dagobah can now execute commands on remote machines that you have SSH access to, without installing anything on the remote machines! The process to set up is pretty simple.

Edit your SSH config

The underlying library paramiko uses the standard OpenSSH config to manage hosts. The config is typically located at ~/.ssh/config for the user that dagobahd runs as. In many cases this file won't exist unless you've made one before. **NOTE: ** Our use of the ssh config does not support wildcard domains, so please list one config section per host (an example of one is shown below).

For dagobah, entries only need 3 pieces of info: Host name, user, and the SSH key. An example config looks like this:

# Contents of ~/.ssh/config
Host server_nickname
     HostName actual.address.or.ip.com
     User remoteuser
     IdentityFile ~/.ssh/id_rsa

The server_nickname is the name we will use to refer to the server from Dagobah (and you can use it on the command line). The HostName is that address you want to SSH into, it can be a fully qualified domain, a local address on your internal network, or an IP address. The IdentityFile is the private key you use to SSH into the machine. If you don't know how to set up SSH keys, try this guide.

You should now test command line SSH with your new server nickname. In this example, I previously would use this to SSH (normally you don't have to specify the private key, but I'm including it for clarity):

ssh -i ~/.ssh/id_rsa [email protected]

But now, you only need

ssh server_nickname

And it should work!

If you want to learn more about ssh configs, you can read more here

Try to Create a task on a remote machine

Open a new or existing job, and go to the "Add New Task" section. Click the "remote" option and a dropdown should show up allowing you to specify what machine it will run on. I tend to test with a "pwd" command, but there's a number of other commands you can use to verify the command ran remotely. Tasks look and act jsut like local tasks, so that's about it, have fun!

Troubleshooting

At time of writing, there isn't a whole lot of help in place for debugging issues, but if you did the ssh test above (try adding -v and verifying it's using the SSH key that you specified in the config) and successfully logged into the machine, but Dagobah seems to freeze and/or throw exceptions (check the dagobahd stdout/stderr), you should file a bug report. But generally if you can ssh on commandline using the name in the config, Dagobah should work as well.