2012-10-02 19:40:28 +00:00
|
|
|
#!/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/>.
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
---
|
|
|
|
module: fail
|
|
|
|
short_description: Fail with custom message
|
|
|
|
description:
|
|
|
|
- This module fails the progress with a custom message. It can be
|
2013-07-08 21:22:05 +00:00
|
|
|
useful for bailing out when a certain condition is met using C(when).
|
2012-10-02 19:40:28 +00:00
|
|
|
version_added: "0.8"
|
|
|
|
options:
|
|
|
|
msg:
|
|
|
|
description:
|
2012-11-21 17:49:30 +00:00
|
|
|
- The customized message used for failing execution. If omitted,
|
2012-10-02 19:40:28 +00:00
|
|
|
fail will simple bail out with a generic message.
|
|
|
|
required: false
|
2012-11-07 22:18:28 +00:00
|
|
|
default: "'Failed as requested from task'"
|
2012-10-04 18:58:07 +00:00
|
|
|
|
2012-10-02 19:40:28 +00:00
|
|
|
author: Dag Wieers
|
|
|
|
'''
|
2013-06-14 09:53:43 +00:00
|
|
|
|
|
|
|
EXAMPLES = '''
|
2013-07-08 21:22:05 +00:00
|
|
|
# Example playbook using fail and when together
|
2013-06-14 09:53:43 +00:00
|
|
|
- fail: msg="The system may not be provisioned according to the CMDB status."
|
2013-12-27 00:32:32 +00:00
|
|
|
when: cmdb_status != "to-be-staged"
|
2013-06-14 09:53:43 +00:00
|
|
|
'''
|