summaryrefslogtreecommitdiff
path: root/utilities/logic/fail.py
blob: 544758ad1000770b9f803ab36c29e70a5a4b52c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright 2012 Dag Wieers <dag@wieers.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.

ANSIBLE_METADATA = {'status': ['stableinterface'],
                    'supported_by': 'core',
                    'version': '1.0'}

DOCUMENTATION = '''
---
module: fail
short_description: Fail with custom message
description:
     - This module fails the progress with a custom message. It can be
       useful for bailing out when a certain condition is met using C(when).
version_added: "0.8"
options:
  msg:
    description:
      - The customized message used for failing execution. If omitted,
        fail will simple bail out with a generic message.
    required: false
    default: "'Failed as requested from task'"

author: "Dag Wieers (@dagwieers)"
'''

EXAMPLES = '''
# Example playbook using fail and when together
- fail:
    msg: "The system may not be provisioned according to the CMDB status."
  when: cmdb_status != "to-be-staged"
'''