def rax_find_server(module, rax_module, server):
 cs = rax_module.cloudservers
 try:
  UUID(server)
  server = cs.servers.get(server)
 except ValueError:
  servers = cs.servers.list(search_opts=dict(name=('^%s$' % server)))
  if (not servers):
   module.fail_json(msg='No Server was matched by name, try using the Server ID instead')
  if (len(servers) > 1):
   module.fail_json(msg='Multiple servers matched by name, try using the Server ID instead')
  server = servers[0]
 return server

def rax_find_server ( module , rax_module , server ) : cs = rax_module . cloudservers try : UUID ( server ) server = cs . servers . get ( server ) except ValueError : servers = cs . servers . list ( search_opts = dict ( name = ( '^%s$' % server ) ) ) if ( not servers ) : module . fail_json ( msg = 'No Server was matched by name, try using the Server ID instead' ) if ( len ( servers ) > 1 ) : module . fail_json ( msg = 'Multiple servers matched by name, try using the Server ID instead' ) server = servers [ 0 ] return server
find a cloud server by id or name .