os_server_facts: support all_projects (#44800)

* os_server_facts: support all_projects

* os_server_facts: openstacksdk expects True or False, not None
pull/48379/head
James Cassell 6 years ago committed by Sam Doran
parent dda753dc05
commit c13fa503a1

@ -0,0 +1,4 @@
---
minor_changes:
- os_server_facts - added all_projects option to gather server facts from all
available projects

@ -45,6 +45,13 @@ options:
availability_zone:
description:
- Ignored. Present for backwards compatibility
all_projects:
description:
- Whether to list servers from all projects or just the current auth
scoped project.
type: bool
default: 'no'
version_added: "2.8"
extends_documentation_fragment: openstack
'''
@ -69,8 +76,9 @@ def main():
argument_spec = openstack_full_argument_spec(
server=dict(required=False),
detailed=dict(required=False, type='bool'),
filters=dict(required=False, type='dict', default=None)
detailed=dict(required=False, type='bool', default=False),
filters=dict(required=False, type='dict', default=None),
all_projects=dict(required=False, type='bool', default=False),
)
module_kwargs = openstack_module_kwargs()
module = AnsibleModule(argument_spec, **module_kwargs)
@ -78,7 +86,8 @@ def main():
sdk, cloud = openstack_cloud_from_module(module)
try:
openstack_servers = cloud.search_servers(
detailed=module.params['detailed'], filters=module.params['filters'])
detailed=module.params['detailed'], filters=module.params['filters'],
all_projects=module.params['all_projects'])
if module.params['server']:
# filter servers by name

Loading…
Cancel
Save