From aada86471824e8bac6b10da3c8bae432e11af999 Mon Sep 17 00:00:00 2001 From: Greg Harvey Date: Sun, 25 Jan 2026 21:12:06 +0100 Subject: [PATCH] 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 * Updating docs to show both org and project ID options. * Moving deprecated example to the end. --------- Co-authored-by: Felix Fontein --- .../11368-scaleway-ip-project-param.yml | 2 ++ plugins/modules/scaleway_ip.py | 30 ++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/11368-scaleway-ip-project-param.yml diff --git a/changelogs/fragments/11368-scaleway-ip-project-param.yml b/changelogs/fragments/11368-scaleway-ip-project-param.yml new file mode 100644 index 0000000000..c4ee1f5fef --- /dev/null +++ b/changelogs/fragments/11368-scaleway-ip-project-param.yml @@ -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). diff --git a/plugins/modules/scaleway_ip.py b/plugins/modules/scaleway_ip.py index 4c60ebd4df..121c1bed4a 100644 --- a/plugins/modules/scaleway_ip.py +++ b/plugins/modules/scaleway_ip.py @@ -41,7 +41,14 @@ options: type: str description: - 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: type: str @@ -79,9 +86,9 @@ options: """ EXAMPLES = r""" -- name: Create an IP +- name: Create an IP with a project ID community.general.scaleway_ip: - organization: '{{ scw_org }}' + project: '{{ project_id }}' state: present region: par1 register: ip_creation_task @@ -91,6 +98,13 @@ EXAMPLES = r""" id: '{{ ip_creation_task.scaleway_ip.id }}' state: absent 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""" @@ -227,6 +241,7 @@ def absent_strategy(api, wished_ip): def core(module): wished_ip = { "organization": module.params["organization"], + "project": module.params["project"], "reverse": module.params["reverse"], "id": module.params["id"], "server": module.params["server"], @@ -248,7 +263,8 @@ def main(): argument_spec.update( dict( state=dict(default="present", choices=["absent", "present"]), - organization=dict(required=True), + organization=dict(), + project=dict(), server=dict(), reverse=dict(), region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())), @@ -258,6 +274,12 @@ def main(): module = AnsibleModule( argument_spec=argument_spec, supports_check_mode=True, + mutually_exclusive=[ + ("organization", "project"), + ], + required_one_of=[ + ("organization", "project"), + ], ) core(module)