mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudstack: cs_ip_address: fix vpc support (#22625)
* cloudstack: cs_ip_address: fix vpc support * cloudstack: cs_ip_address: fix pep8
This commit is contained in:
parent
ce56da69b2
commit
a227a4ebb4
1 changed files with 18 additions and 15 deletions
|
@ -132,8 +132,13 @@ domain:
|
|||
sample: example domain
|
||||
'''
|
||||
|
||||
# import cloudstack common
|
||||
from ansible.module_utils.cloudstack import *
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.cloudstack import (
|
||||
AnsibleCloudStack,
|
||||
CloudStackException,
|
||||
cs_argument_spec,
|
||||
cs_required_together,
|
||||
)
|
||||
|
||||
|
||||
class AnsibleCloudStackIPAddress(AnsibleCloudStack):
|
||||
|
@ -147,8 +152,6 @@ class AnsibleCloudStackIPAddress(AnsibleCloudStack):
|
|||
def get_ip_address(self, key=None):
|
||||
if self.ip_address:
|
||||
return self._get_by_key(key, self.ip_address)
|
||||
|
||||
ip_address = self.module.params.get('ip_address')
|
||||
args = {
|
||||
'ipaddress': self.module.params.get('ip_address'),
|
||||
'account': self.get_account(key='name'),
|
||||
|
@ -170,6 +173,7 @@ class AnsibleCloudStackIPAddress(AnsibleCloudStack):
|
|||
'projectid': self.get_project(key='id'),
|
||||
'networkid': self.get_network(key='id'),
|
||||
'zoneid': self.get_zone(key='id'),
|
||||
'vpcid': self.get_vpc(key='id'),
|
||||
}
|
||||
ip_address = None
|
||||
if not self.module.check_mode:
|
||||
|
@ -205,12 +209,12 @@ def main():
|
|||
argument_spec.update(dict(
|
||||
ip_address=dict(required=False),
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
vpc = dict(default=None),
|
||||
network = dict(default=None),
|
||||
zone = dict(default=None),
|
||||
domain = dict(default=None),
|
||||
account = dict(default=None),
|
||||
project = dict(default=None),
|
||||
vpc=dict(),
|
||||
network=dict(),
|
||||
zone=dict(),
|
||||
domain=dict(),
|
||||
account=dict(),
|
||||
project=dict(),
|
||||
poll_async=dict(type='bool', default=True),
|
||||
))
|
||||
|
||||
|
@ -239,7 +243,6 @@ def main():
|
|||
|
||||
module.exit_json(**result)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue