ansible常用模块 -- fial模块 -- 自定义消息失败
fial模块 – 自定义消息失败
一、摘要
- 此模块使用自定义消息使进度失败
- 它可以用于在满足特定条件时进行救助。
- Windows目标也支持此模块。
二、参数
参数 | 选项/默认值 | 描述 |
---|---|---|
msg string | Default: “Failed as requested from task” | 用于执行失败的自定义消息。 如果省略,fail将简单地用通用消息进行保释。 |
三、示例
# 使用fail和when在一起的例子剧本
- fail:
msg: The system may not be provisioned according to the CMDB status.
when: cmdb_status != "to-be-staged"
官方文档:https://docs.ansible.com/ansible/2.9/modules/fail_module.html#fail-module