cs_ip_address: fix vpc and network mutually exclusive (#47846)

* cs_ip_address: fix vpc and network mutually exclusive

* add changelog

* streamline docs
This commit is contained in:
René Moser 2018-11-01 07:26:08 +01:00 committed by GitHub
parent 8e561d1eb4
commit 242bd512d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 355 additions and 209 deletions

View file

@ -27,16 +27,18 @@ options:
ip_address:
description:
- Public IP address.
- Required if C(state=absent) and C(tags) is not set
- Required if I(state=absent) and I(tags) is not set.
domain:
description:
- Domain the IP address is related to.
network:
description:
- Network the IP address is related to.
- Mutually exclusive with I(vpc).
vpc:
description:
- VPC the IP address is related to.
- Mutually exclusive with I(network).
version_added: "2.2"
account:
description:
@ -55,7 +57,7 @@ options:
choices: [ present, absent ]
tags:
description:
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
- List of tags. Tags are a list of dictionaries having keys I(key) and I(value).
- Tags can be used as an unique identifier for the IP Addresses.
- In this case, at least one of them must be unique to ensure idempontency.
aliases: [ 'tag' ]
@ -195,7 +197,8 @@ class AnsibleCloudStackIPAddress(AnsibleCloudStack):
'account': self.get_account(key='name'),
'domainid': self.get_domain(key='id'),
'projectid': self.get_project(key='id'),
'networkid': self.get_network(key='id'),
# For the VPC case networkid is irrelevant, special case and we have to ignore it here.
'networkid': self.get_network(key='id') if not self.module.params.get('vpc') else None,
'zoneid': self.get_zone(key='id'),
'vpcid': self.get_vpc(key='id'),
}
@ -249,6 +252,9 @@ def main():
required_if=[
('state', 'absent', ['ip_address', 'tags'], True),
],
mutually_exclusive=(
['vpc', 'network'],
),
supports_check_mode=True
)