mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Pass through nova region name
If the region name is specified in the config, we need to pass it in to the nova client constructor. Since key_name is similarly optional, go ahead and handle both parameters the same.
This commit is contained in:
parent
10a50b4a61
commit
8938222029
1 changed files with 4 additions and 3 deletions
|
@ -308,13 +308,14 @@ def _create_server(module, nova):
|
|||
bootkwargs = {
|
||||
'nics' : module.params['nics'],
|
||||
'meta' : module.params['meta'],
|
||||
'key_name': module.params['key_name'],
|
||||
'security_groups': module.params['security_groups'].split(','),
|
||||
#userdata is unhyphenated in novaclient, but hyphenated here for consistency with the ec2 module:
|
||||
'userdata': module.params['user_data'],
|
||||
}
|
||||
if not module.params['key_name']:
|
||||
del bootkwargs['key_name']
|
||||
|
||||
for optional_param in ('region_name', 'key_name'):
|
||||
if module.params[optional_param]:
|
||||
bootkwargs[optional_param] = module.params[optional_param]
|
||||
try:
|
||||
server = nova.servers.create(*bootargs, **bootkwargs)
|
||||
server = nova.servers.get(server.id)
|
||||
|
|
Loading…
Reference in a new issue