1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add support of project id for scawelay_compute (#3951)

* Add support of project id for scawelay_compute

* Create 3951-scaleway_compute_add_project_id

* rename changelog frament

* remove useless whitespace in scaleway_compute.py

* Update changelogs/fragments/3951-scaleway_compute_add_project_id.yml

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

* Update plugins/modules/cloud/scaleway/scaleway_compute.py

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

* correct documentation

* Update changelogs/fragments/3951-scaleway_compute_add_project_id.yml

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

* Update changelogs/fragments/3951-scaleway_compute_add_project_id.yml

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

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
pmangin 2021-12-28 15:03:14 +01:00 committed by GitHub
parent 3f2364574d
commit e4882b3a3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 8 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- scaleway_compute - add possibility to use project identifier (new ``project`` option) instead of deprecated organization identifier (https://github.com/ansible-collections/community.general/pull/3951).

View file

@ -54,8 +54,15 @@ options:
organization:
type: str
description:
- Organization identifier
required: true
- Organization identifier.
- Exactly one of I(project) and I(organization) must be specified.
project:
type: str
description:
- Project identifier.
- Exactly one of I(project) and I(organization) must be specified.
version_added: 4.3.0
state:
type: str
@ -132,7 +139,7 @@ EXAMPLES = '''
name: foobar
state: present
image: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
project: 951df375-e094-4d26-97c1-ba548eeb9c42
region: ams1
commercial_type: VC1S
tags:
@ -144,7 +151,7 @@ EXAMPLES = '''
name: foobar
state: present
image: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
project: 951df375-e094-4d26-97c1-ba548eeb9c42
region: ams1
commercial_type: VC1S
security_group: 4a31b633-118e-4900-bd52-facf1085fc8d
@ -157,7 +164,7 @@ EXAMPLES = '''
name: foobar
state: absent
image: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
project: 951df375-e094-4d26-97c1-ba548eeb9c42
region: ams1
commercial_type: VC1S
'''
@ -269,10 +276,15 @@ def create_server(compute_api, server):
"commercial_type": server["commercial_type"],
"image": server["image"],
"dynamic_ip_required": server["dynamic_ip_required"],
"name": server["name"],
"organization": server["organization"]
"name": server["name"]
}
if server["project"]:
data["project"] = server["project"]
if server["organization"]:
data["organization"] = server["organization"]
if server["security_group"]:
data["security_group"] = server["security_group"]
@ -628,6 +640,7 @@ def core(module):
"enable_ipv6": module.params["enable_ipv6"],
"tags": module.params["tags"],
"organization": module.params["organization"],
"project": module.params["project"],
"security_group": module.params["security_group"]
}
module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
@ -655,7 +668,8 @@ def main():
public_ip=dict(default="absent"),
state=dict(choices=list(state_strategy.keys()), default='present'),
tags=dict(type="list", elements="str", default=[]),
organization=dict(required=True),
organization=dict(),
project=dict(),
wait=dict(type="bool", default=False),
wait_timeout=dict(type="int", default=300),
wait_sleep_time=dict(type="int", default=3),
@ -664,6 +678,12 @@ def main():
module = AnsibleModule(
argument_spec=argument_spec,
supports_check_mode=True,
mutually_exclusive=[
('organization', 'project'),
],
required_one_of=[
('organization', 'project'),
],
)
core(module)