community.general.linode_v4 module – Manage instances on the Linode cloud.

Note

This module is part of the community.general collection (version 4.8.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.linode_v4.

Synopsis

  • Manage instances on the Linode cloud.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.7

  • linode_api4 >= 2.0.0

Parameters

Parameter

Comments

access_token

string / required

The Linode API v4 access token. It may also be specified by exposing the LINODE_ACCESS_TOKEN environment variable. See https://www.linode.com/docs/api#access-and-authentication.

authorized_keys

list / elements=string

A list of SSH public key parts to deploy for the root user.

group

string

The group that the instance should be marked under. Please note, that group labelling is deprecated but still supported. The encouraged method for marking instances is to use tags.

image

string

The image of the instance. This is a required parameter only when creating Linode instances. See https://www.linode.com/docs/api/images/.

label

string / required

The instance label. This label is used as the main determiner for idempotence for the module and is therefore mandatory.

private_ip

boolean

added in 3.0.0 of community.general

If true, the created Linode will have private networking enabled and assigned a private IPv4 address.

Choices:

  • no ← (default)

  • yes

region

string

The region of the instance. This is a required parameter only when creating Linode instances. See https://www.linode.com/docs/api/regions/.

root_pass

string

The password for the root user. If not specified, one will be generated. This generated password will be available in the task success JSON.

stackscript_data

dictionary

added in 1.3.0 of community.general

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 https://www.linode.com/docs/api/stackscripts/.

stackscript_id

integer

added in 1.3.0 of community.general

The numeric ID of the StackScript to use when creating the instance. See https://www.linode.com/docs/api/stackscripts/.

state

string / required

The desired instance state.

Choices:

  • present

  • absent

tags

list / elements=string

The tags that the instance should be marked under. See https://www.linode.com/docs/api/tags/.

type

string

The type of the instance. This is a required parameter only when creating Linode instances. See https://www.linode.com/docs/api/linode-types/.

Notes

Note

  • No Linode resizing is currently implemented. This module will, in time, replace the current Linode module which uses deprecated API bindings on the Linode side.

Examples

- name: Create a new Linode.
  community.general.linode_v4:
    label: new-linode
    type: g6-nanode-1
    region: eu-west
    image: linode/debian9
    root_pass: passw0rd
    authorized_keys:
      - "ssh-rsa ..."
    stackscript_id: 1337
    stackscript_data:
      variable: value
    state: present

- name: Delete that new Linode.
  community.general.linode_v4:
    label: new-linode
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

instance

dictionary

The instance description in JSON serialized form.

Returned: Always.

Sample: {“alerts”: {“cpu”: 90, “io”: 10000, “network_in”: 10, “network_out”: 10, “transfer_quota”: 80}, “backups”: {“enabled”: false, “schedule”: {“day”: null, “window”: null}}, “created”: “2018-09-26T08:12:33”, “group”: “Foobar Group”, “hypervisor”: “kvm”, “id”: 10480444, “image”: “linode/centos7”, “ipv4”: [“130.132.285.233”], “ipv6”: “2a82:7e00::h03c:46ff:fe04:5cd2/64”, “label”: “lin-foo”, “region”: “eu-west”, “root_pass”: “foobar”, “specs”: {“disk”: 25600, “memory”: 1024, “transfer”: 1000, “vcpus”: 1}, “status”: “running”, “tags”: [], “type”: “g6-nanode-1”, “updated”: “2018-09-26T10:10:14”, “watchdog_enabled”: true}

Authors

  • Luke Murphy (@decentral1se)