通过cron模块调用playbook实现定时查询ip 端口 后台api接口是否正常
1.环境变量问题
远程调用ansible需要设置ansible环境变量,在~/.bashrc中写死定义好
cron模块也需要设置环境变量,在批处理文件中source ~/.bashrc
遇到bash: playbook/cron.sh:/bin/bash^M:解释器错误: 没有那个文件或目录
由于sh在window机器上编辑上传导致
sed -i 's/\r$//' cron.sh
通过cron模块调用playbook实现定时查询ip 端口 后台api接口是否正常
1.环境变量问题
远程调用ansible需要设置ansible环境变量,在~/.bashrc中写死定义好
cron模块也需要设置环境变量,在批处理文件中source ~/.bashrc
遇到bash: playbook/cron.sh:/bin/bash^M:解释器错误: 没有那个文件或目录
由于sh在window机器上编辑上传导致
sed -i 's/\r$//' cron.sh