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 for StackScripts to Linode v4 module (#1270) (#1288)

* Add support for StackScripts to Linode v4 module

* Apply suggestions from code review

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

* add changelog fragment

* Add stackscript to example

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 637eaa15de)

Co-authored-by: rmcintosh <rmcintosh@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2020-11-13 12:59:28 +01:00 committed by GitHub
parent 1ce00126c5
commit 71b63e6a75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 5 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- linode_v4 - added support for Linode StackScript usage when creating instances (https://github.com/ansible-collections/community.general/issues/723).

View file

@ -27,21 +27,21 @@ options:
description:
- The region of the instance. This is a required parameter only when
creating Linode instances. See
U(https://developers.linode.com/api/v4#tag/Regions).
U(https://www.linode.com/docs/api/regions/).
required: false
type: str
image:
description:
- The image of the instance. This is a required parameter only when
creating Linode instances. See
U(https://developers.linode.com/api/v4#tag/Images).
U(https://www.linode.com/docs/api/images/).
type: str
required: false
type:
description:
- The type of the instance. This is a required parameter only when
creating Linode instances. See
U(https://developers.linode.com/api/v4#tag/Linode-Types).
U(https://www.linode.com/docs/api/linode-types/).
type: str
required: false
label:
@ -60,7 +60,7 @@ options:
tags:
description:
- The tags that the instance should be marked under. See
U(https://developers.linode.com/api/v4#tag/Tags).
U(https://www.linode.com/docs/api/tags/).
required: false
type: list
root_pass:
@ -87,8 +87,22 @@ options:
description:
- The Linode API v4 access token. It may also be specified by exposing
the C(LINODE_ACCESS_TOKEN) environment variable. See
U(https://developers.linode.com/api/v4#section/Access-and-Authentication).
U(https://www.linode.com/docs/api#access-and-authentication).
required: true
stackscript_id:
description:
- The numeric ID of the StackScript to use when creating the instance.
See U(https://www.linode.com/docs/api/stackscripts/).
type: int
version_added: 1.3.0
stackscript_data:
description:
- An object containing arguments to any User Defined Fields present in
the StackScript used when creating the instance.
Only valid when a stackscript_id is provided.
See U(https://www.linode.com/docs/api/stackscripts/).
type: dict
version_added: 1.3.0
'''
EXAMPLES = """
@ -101,6 +115,9 @@ EXAMPLES = """
root_pass: passw0rd
authorized_keys:
- "ssh-rsa ..."
stackscript_id: 1337
stackscript_data:
variable: value
state: present
- name: Delete that new Linode.
@ -229,6 +246,8 @@ def initialise_module():
root_pass=dict(type='str', required=False, no_log=True),
tags=dict(type='list', required=False),
type=dict(type='str', required=False),
stackscript_id=dict(type='int', required=False),
stackscript_data=dict(type='dict', required=False),
),
supports_check_mode=False,
required_one_of=(
@ -272,6 +291,8 @@ def main():
root_pass=module.params['root_pass'],
tags=module.params['tags'],
ltype=module.params['type'],
stackscript=module.params['stackscript_id'],
stackscript_data=module.params['stackscript_data'],
)
module.exit_json(changed=True, instance=instance_json)