mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
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:
parent
8e561d1eb4
commit
242bd512d0
6 changed files with 355 additions and 209 deletions
|
@ -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
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue