Add a 'warn' ansible module

This module simply adds the provided string to the `warnings` ansible
output.

Change-Id: Ia0046b284228a5da7257921bc5446266c4c3c0d8
This commit is contained in:
Martin André 2017-02-20 16:54:06 -05:00
parent 6b928f1c15
commit 311411122b
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
features:
- |
Add a new `warn` ansible module that simply adds a string to the 'warnings'
ansible output.

View File

@ -0,0 +1,32 @@
#!/usr/bin/env python
# Copyright 2017 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from ansible.module_utils.basic import * # noqa
def main():
module = AnsibleModule(argument_spec=dict(
msg=dict(required=True, type='str'),
))
msg = module.params.get('msg')
module.exit_json(changed=False,
warnings=[msg])
if __name__ == '__main__':
main()