Debian Codegraph @

lib/ansible/modules/fail.py

raw
1 # -*- coding: utf-8 -*-
2
3 # Copyright: (c) 2012, Dag Wieers <[email protected]>
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 from __future__ import annotations
7
8
9 DOCUMENTATION = r"""
10 ---
11 module: fail
12 short_description: Fail with custom message
13 description:
14 - This module fails the progress with a custom message.
15 - It can be useful for bailing out when a certain condition is met using C(when).
16 - This module is also supported for Windows targets.
17 version_added: "0.8"
18 options:
19 msg:
20 description:
21 - The customized message used for failing execution.
22 - If omitted, fail will simply bail out with a generic message.
23 type: str
24 default: Failed as requested from task
25 extends_documentation_fragment:
26 - action_common_attributes
27 - action_common_attributes.conn
28 - action_common_attributes.flow
29 attributes:
30 action:
31 support: full
32 async:
33 support: none
34 become:
35 support: none
36 bypass_host_loop:
37 support: none
38 connection:
39 support: none
40 check_mode:
41 support: full
42 diff_mode:
43 support: none
44 delegation:
45 details: Aside from C(register) and/or in combination with C(delegate_facts), it has little effect.
46 support: partial
47 platform:
48 platforms: all
49 seealso:
50 - module: ansible.builtin.assert
51 - module: ansible.builtin.debug
52 - module: ansible.builtin.meta
53 author:
54 - Dag Wieers (@dagwieers)
55 """
56
57 EXAMPLES = r"""
58 - name: Example using fail and when together
59 ansible.builtin.fail:
60 msg: The system may not be provisioned according to the CMDB status.
61 when: cmdb_status != "to-be-staged"
62 """