NOT available for airflow 2.x.
I think that I just figured it out:
-
Create a SSH connection in UI under Admin > Connection. Note: the connection will be deleted if you reset the database
-
In the Python file add the following
from airflow.contrib.hooks import SSHHook sshHook = SSHHook(conn_id=<YOUR CONNECTION ID FROM THE UI>) -
Add the SSH operator task
t1 = SSHExecuteOperator( task_id="task1", bash_command=<YOUR COMMAND>, ssh_hook=sshHook, dag=dag)
Thanks!