allow server facts to be retrieved by nova UUID (#20924)

* allow server facts to be retrieved by nova UUID

* update docs to state that a nova UUID can be passed to 'server'
This commit is contained in:
Dave Buckley 2017-02-23 19:34:46 +00:00 committed by Ricardo Carrillo Cruz
parent a3099b2294
commit 776116e809

View file

@ -35,7 +35,7 @@ requirements:
options: options:
server: server:
description: description:
- restrict results to servers with names matching - restrict results to servers with names or UUID matching
this glob expression (e.g., C<web*>). this glob expression (e.g., C<web*>).
required: false required: false
default: None default: None
@ -92,7 +92,7 @@ def main():
# filter servers by name # filter servers by name
pattern = module.params['server'] pattern = module.params['server']
openstack_servers = [server for server in openstack_servers openstack_servers = [server for server in openstack_servers
if fnmatch.fnmatch(server['name'], pattern)] if fnmatch.fnmatch(server['name'], pattern) or fnmatch.fnmatch(server['id'], pattern)]
module.exit_json(changed=False, ansible_facts=dict( module.exit_json(changed=False, ansible_facts=dict(
openstack_servers=openstack_servers)) openstack_servers=openstack_servers))