airflow dag 运行 远程调度命令 特如 sshpass
有时需要在airflow中运行如sshpass远程免密登录调度指令的
所需元素
1、包:from airflow.contrib.operators.ssh_operator import SSHOperator
2、bash
sh_bash = '''
sshpass -p ‘XXXXXX’ ssh XXXXX@IP 'bash XX.sh'
'''
3、operator
XXXXXX_operator = SSHOperator(
task_id='XXXXXX',
command=sh_bash,
ssh_conn_id='XXXXXXX',
dag=dag)