3 # Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
5 # This module is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This software is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this software. If not, see <http://www.gnu.org/licenses/>.
25 module: os_stack_facts
26 short_description: Retrieve facts about an stack within OpenStack.
28 author: "Originally: Davide Agnello (@dagnello); modified"
30 - Retrieve facts about a stack from OpenStack.
32 - Facts are placed in the C(openstack) variable.
37 extends_documentation_fragment: openstack
41 # Gather facts about a previously created stack named stack1
44 auth_url: https://your_api_url.com:9000/v2.0
47 project_name: someproject
48 - debug: var=openstack_stacks
53 description: has all the openstack facts about the stack
54 returned: always, but can be null
61 argument_spec = openstack_full_argument_spec(
63 module_kwargs = openstack_module_kwargs()
64 module = AnsibleModule(argument_spec, **module_kwargs)
67 module.fail_json(msg='shade is required for this module')
71 cloud = shade.openstack_cloud(**module.params)
72 stacks = cloud.list_stacks()
73 module.exit_json(changed=False, ansible_facts={
74 'openstack_stacks': stacks})
76 except shade.OpenStackCloudException as e:
77 module.fail_json(msg=str(e))
79 # this is magic, see lib/ansible/module_common.py
80 from ansible.module_utils.basic import *
81 from ansible.module_utils.openstack import *
82 if __name__ == '__main__':