执行python脚本返回值的Ansible命令始终为rc = 0,而不是脚本退出值

时间:2019-05-08 09:14:57

标签: shell ansible return-value

执行命令的脚本可以将返回代码注册为rc = 0,即使返回代码不同

可完成的任务:

:
- name: executing python script
  command: /var/config_apply.py
  register: py_return

- debug: var=py_return

python脚本具有sys.exit(1)

运行ansible-playbook脚本并且config_apply.py脚本以sys.exit(1)退出,即使py_return.rc始终为0

0 个答案:

没有答案
相关问题