mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-03 15:10:21 -07:00
os_server_facts: support all_projects (#44800)
* os_server_facts: support all_projects * os_server_facts: openstacksdk expects True or False, not None
This commit is contained in:
parent
dda753dc05
commit
c13fa503a1
2 changed files with 16 additions and 3 deletions
4
changelogs/fragments/os-server-facts-all-projects.yaml
Normal file
4
changelogs/fragments/os-server-facts-all-projects.yaml
Normal file
|
@ -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:
|
availability_zone:
|
||||||
description:
|
description:
|
||||||
- Ignored. Present for backwards compatibility
|
- 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
|
extends_documentation_fragment: openstack
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -69,8 +76,9 @@ def main():
|
||||||
|
|
||||||
argument_spec = openstack_full_argument_spec(
|
argument_spec = openstack_full_argument_spec(
|
||||||
server=dict(required=False),
|
server=dict(required=False),
|
||||||
detailed=dict(required=False, type='bool'),
|
detailed=dict(required=False, type='bool', default=False),
|
||||||
filters=dict(required=False, type='dict', default=None)
|
filters=dict(required=False, type='dict', default=None),
|
||||||
|
all_projects=dict(required=False, type='bool', default=False),
|
||||||
)
|
)
|
||||||
module_kwargs = openstack_module_kwargs()
|
module_kwargs = openstack_module_kwargs()
|
||||||
module = AnsibleModule(argument_spec, **module_kwargs)
|
module = AnsibleModule(argument_spec, **module_kwargs)
|
||||||
|
@ -78,7 +86,8 @@ def main():
|
||||||
sdk, cloud = openstack_cloud_from_module(module)
|
sdk, cloud = openstack_cloud_from_module(module)
|
||||||
try:
|
try:
|
||||||
openstack_servers = cloud.search_servers(
|
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']:
|
if module.params['server']:
|
||||||
# filter servers by name
|
# filter servers by name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue