|
|
|
@ -198,12 +198,6 @@ options:
|
|
|
|
|
- Consider switching to HTTP_POST by using C(CLOUDSTACK_METHOD=post) to increase the HTTP_GET size limit of 2KB to 32 KB.
|
|
|
|
|
required: false
|
|
|
|
|
default: null
|
|
|
|
|
vpc:
|
|
|
|
|
description:
|
|
|
|
|
- Name of the VPC.
|
|
|
|
|
required: false
|
|
|
|
|
default: null
|
|
|
|
|
version_added: "2.3"
|
|
|
|
|
force:
|
|
|
|
|
description:
|
|
|
|
|
- Force stop/start the instance if required to apply changes, otherwise a running instance will not be changed.
|
|
|
|
@ -524,22 +518,16 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|
|
|
|
instance = self.instance
|
|
|
|
|
if not instance:
|
|
|
|
|
instance_name = self.get_or_fallback('name', 'display_name')
|
|
|
|
|
vpc_id = self.get_vpc(key='id')
|
|
|
|
|
args = {
|
|
|
|
|
'account': self.get_account(key='name'),
|
|
|
|
|
'domainid': self.get_domain(key='id'),
|
|
|
|
|
'projectid': self.get_project(key='id'),
|
|
|
|
|
'vpcid': vpc_id,
|
|
|
|
|
}
|
|
|
|
|
# Do not pass zoneid, as the instance name must be unique across zones.
|
|
|
|
|
instances = self.cs.listVirtualMachines(**args)
|
|
|
|
|
if instances:
|
|
|
|
|
for v in instances['virtualmachine']:
|
|
|
|
|
# Due the limitation of the API, there is no easy way (yet) to get only those VMs
|
|
|
|
|
# not belonging to a VPC.
|
|
|
|
|
if not vpc_id and self.is_vm_in_vpc(vm=v):
|
|
|
|
|
continue
|
|
|
|
|
if instance_name.lower() in [ v['name'].lower(), v['displayname'].lower(), v['id'] ]:
|
|
|
|
|
if instance_name.lower() in [v['name'].lower(), v['displayname'].lower(), v['id']]:
|
|
|
|
|
self.instance = v
|
|
|
|
|
break
|
|
|
|
|
return self.instance
|
|
|
|
@ -636,7 +624,6 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|
|
|
|
'domainid': self.get_domain(key='id'),
|
|
|
|
|
'projectid': self.get_project(key='id'),
|
|
|
|
|
'zoneid': self.get_zone(key='id'),
|
|
|
|
|
'vpcid': self.get_vpc(key='id'),
|
|
|
|
|
}
|
|
|
|
|
networks = self.cs.listNetworks(**args)
|
|
|
|
|
if not networks:
|
|
|
|
@ -1017,7 +1004,6 @@ def main():
|
|
|
|
|
ssh_key = dict(default=None),
|
|
|
|
|
force = dict(type='bool', default=False),
|
|
|
|
|
tags = dict(type='list', aliases=[ 'tag' ], default=None),
|
|
|
|
|
vpc = dict(default=None),
|
|
|
|
|
poll_async = dict(type='bool', default=True),
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|