diff --git a/releasenotes/notes/add-warn-helper-a586ba13c7e8b43b.yaml b/releasenotes/notes/add-warn-helper-a586ba13c7e8b43b.yaml new file mode 100644 index 000000000..d7c2d53f4 --- /dev/null +++ b/releasenotes/notes/add-warn-helper-a586ba13c7e8b43b.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add a new `warn` ansible module that simply adds a string to the 'warnings' + ansible output. diff --git a/validations/library/warn.py b/validations/library/warn.py new file mode 100644 index 000000000..d46952869 --- /dev/null +++ b/validations/library/warn.py @@ -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()