1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

Adding 'project' parameter support for the Scaleway SG module. (#11366)

* Adding 'project' parameter support for the Scaleway SG module.

* Adding changelog fragment.

* Fixing documentation, organization is deprecated (although still available).

* Updating docs to show both org and project ID options.

* Incrementing version.

Co-authored-by: Felix Fontein <felix@fontein.de>

* Moving deprecated example to the end.

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Greg Harvey 2026-01-25 21:12:19 +01:00 committed by GitHub
parent aada864718
commit c0df366471
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 5 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- scaleway_security_group - added ``project`` parameter (https://github.com/ansible-collections/community.general/issues/11364, https://github.com/ansible-collections/community.general/pull/11366).

View file

@ -37,10 +37,10 @@ options:
default: present
organization:
type: str
description:
- Organization identifier.
type: str
required: true
- Exactly one of O(project) and O(organization) must be specified.
region:
description:
@ -95,16 +95,36 @@ options:
description:
- Create security group to be the default one.
type: bool
project:
type: str
description:
- Project identifier.
- Exactly one of O(project) and O(organization) must be specified.
version_added: 12.3.0
"""
EXAMPLES = r"""
- name: Create a Security Group
- name: Create a Security Group using a project ID
community.general.scaleway_security_group:
state: present
region: par1
name: security_group
description: "my security group description"
organization: "43a3b6c8-916f-477b-b7ec-ff1898f5fdd9"
stateful: false
inbound_default_policy: accept
outbound_default_policy: accept
organization_default: false
project: 951df375-e094-4d26-97c1-ba548eeb9c42
register: security_group_creation_task
- name: Create a Security Group in the default project using an organization ID (deprecated)
community.general.scaleway_security_group:
state: present
region: par1
name: security_group
description: "my security group description"
organization: 43a3b6c8-916f-477b-b7ec-ff1898f5fdd9
stateful: false
inbound_default_policy: accept
outbound_default_policy: accept
@ -216,6 +236,7 @@ def core(module):
"inbound_default_policy": module.params["inbound_default_policy"],
"outbound_default_policy": module.params["outbound_default_policy"],
"organization_default": module.params["organization_default"],
"project": module.params["project"],
}
region = module.params["region"]
@ -234,7 +255,7 @@ def main():
argument_spec.update(
dict(
state=dict(type="str", default="present", choices=["absent", "present"]),
organization=dict(type="str", required=True),
organization=dict(type="str"),
name=dict(type="str", required=True),
description=dict(type="str"),
region=dict(type="str", required=True, choices=list(SCALEWAY_LOCATION.keys())),
@ -242,12 +263,19 @@ def main():
inbound_default_policy=dict(type="str", choices=["accept", "drop"]),
outbound_default_policy=dict(type="str", choices=["accept", "drop"]),
organization_default=dict(type="bool"),
project=dict(type="str"),
)
)
module = AnsibleModule(
argument_spec=argument_spec,
supports_check_mode=True,
required_if=[["stateful", True, ["inbound_default_policy", "outbound_default_policy"]]],
mutually_exclusive=[
("organization", "project"),
],
required_one_of=[
("organization", "project"),
],
)
core(module)