mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-03 23:41:51 +00:00
Adding 'project' parameter to Scaleway IP module. (#11368)
* Adding 'project' parameter to Scaleway IP module. * Adding changelog fragment. * Incrementing version. Co-authored-by: Felix Fontein <felix@fontein.de> * Updating docs to show both org and project ID options. * Moving deprecated example to the end. --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
f933465658
commit
aada864718
2 changed files with 28 additions and 4 deletions
2
changelogs/fragments/11368-scaleway-ip-project-param.yml
Normal file
2
changelogs/fragments/11368-scaleway-ip-project-param.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- scaleway_ip - added ``project`` parameter (https://github.com/ansible-collections/community.general/issues/11367, https://github.com/ansible-collections/community.general/pull/11368).
|
||||||
|
|
@ -41,7 +41,14 @@ options:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- Scaleway organization identifier.
|
- Scaleway organization identifier.
|
||||||
required: true
|
- Exactly one of O(project) and O(organization) must be specified.
|
||||||
|
|
||||||
|
project:
|
||||||
|
type: str
|
||||||
|
description:
|
||||||
|
- Project identifier.
|
||||||
|
- Exactly one of O(project) and O(organization) must be specified.
|
||||||
|
version_added: 12.3.0
|
||||||
|
|
||||||
region:
|
region:
|
||||||
type: str
|
type: str
|
||||||
|
|
@ -79,9 +86,9 @@ options:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = r"""
|
EXAMPLES = r"""
|
||||||
- name: Create an IP
|
- name: Create an IP with a project ID
|
||||||
community.general.scaleway_ip:
|
community.general.scaleway_ip:
|
||||||
organization: '{{ scw_org }}'
|
project: '{{ project_id }}'
|
||||||
state: present
|
state: present
|
||||||
region: par1
|
region: par1
|
||||||
register: ip_creation_task
|
register: ip_creation_task
|
||||||
|
|
@ -91,6 +98,13 @@ EXAMPLES = r"""
|
||||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||||
state: absent
|
state: absent
|
||||||
region: par1
|
region: par1
|
||||||
|
|
||||||
|
- name: Create an IP in the default project with an organization ID (deprecated)
|
||||||
|
community.general.scaleway_ip:
|
||||||
|
organization: '{{ scw_org }}'
|
||||||
|
state: present
|
||||||
|
region: par1
|
||||||
|
register: ip_creation_task
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = r"""
|
RETURN = r"""
|
||||||
|
|
@ -227,6 +241,7 @@ def absent_strategy(api, wished_ip):
|
||||||
def core(module):
|
def core(module):
|
||||||
wished_ip = {
|
wished_ip = {
|
||||||
"organization": module.params["organization"],
|
"organization": module.params["organization"],
|
||||||
|
"project": module.params["project"],
|
||||||
"reverse": module.params["reverse"],
|
"reverse": module.params["reverse"],
|
||||||
"id": module.params["id"],
|
"id": module.params["id"],
|
||||||
"server": module.params["server"],
|
"server": module.params["server"],
|
||||||
|
|
@ -248,7 +263,8 @@ def main():
|
||||||
argument_spec.update(
|
argument_spec.update(
|
||||||
dict(
|
dict(
|
||||||
state=dict(default="present", choices=["absent", "present"]),
|
state=dict(default="present", choices=["absent", "present"]),
|
||||||
organization=dict(required=True),
|
organization=dict(),
|
||||||
|
project=dict(),
|
||||||
server=dict(),
|
server=dict(),
|
||||||
reverse=dict(),
|
reverse=dict(),
|
||||||
region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
|
region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
|
||||||
|
|
@ -258,6 +274,12 @@ def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
|
mutually_exclusive=[
|
||||||
|
("organization", "project"),
|
||||||
|
],
|
||||||
|
required_one_of=[
|
||||||
|
("organization", "project"),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
core(module)
|
core(module)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue