community.general.linode module – Manage instances on the Linode Public Cloud
Note
This module is part of the community.general collection (version 10.7.5).
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.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.linode.
Synopsis
- Manage Linode Public Cloud instances and optionally wait for it to be ‘running’. 
Requirements
The below requirements are needed on the host that executes this module.
- linode-python 
Parameters
| Parameter | Comments | 
|---|---|
| List of dictionaries for creating additional disks that are added to the Linode configuration settings. Dictionary takes Size, Label, Type. Size is in MB. | |
| Set status of bandwidth in alerts. Choices: 
 | |
| Set threshold in MB of bandwidth in alerts. | |
| Set status of bandwidth out alerts. Choices: 
 | |
| Set threshold in MB of bandwidth out alerts. | |
| Set status of bandwidth quota alerts as percentage of network transfer quota. Choices: 
 | |
| Set threshold in MB of bandwidth quota alerts. | |
| Set status of receiving CPU usage alerts. Choices: 
 | |
| Set percentage threshold for receiving CPU usage alerts. Each CPU core adds 100% to total. | |
| Set status of receiving disk IO alerts. Choices: 
 | |
| Set threshold for average IO ops/sec over 2 hour period. | |
| Linode API key. 
 | |
| Day of the week to take backups. | |
| The time window in which backups are taken. | |
| Datacenter to create an instance in (Linode Datacenter). | |
| Add the instance to a Display Group in Linode Manager. Default:  | |
| Distribution to use for the instance (Linode Distribution). | |
| Kernel to use for the instance (Linode Kernel). | |
| Unique ID of a Linode server. This value is read-only in the sense that if you specify it on creation of a Linode it is not used. The Linode API generates these IDs and we can those generated value here to reference a Linode more specifically. This is useful for idempotency. | |
| Name to give the instance (alphanumeric, dashes, underscore). To keep sanity on the Linode Web Console, name is prepended with  | |
| Root password to apply to a new server (auto generated if missing). | |
| Payment term to use for the instance (payment term in months). Choices: 
 | |
| Plan to use for the instance (Linode plan). | |
| Add private IPv4 address when Linode is created. Default is  Choices: 
 | |
| SSH public key applied to root user. | |
| Indicate desired state of the resource. Choices: 
 | |
| Swap size in MB. Default:  | |
| Wait for the instance to be in state  Choices: 
 | |
| How long before wait gives up, in seconds. Default:  | |
| Set status of Lassie watchdog. Choices: 
 | 
Attributes
| Attribute | Support | Description | 
|---|---|---|
| Support: none | Can run in  | |
| Support: none | Will return details on what has changed (or possibly needs changing in  | 
Notes
Note
- Please note, linode-python does not have python 3 support. 
- This module uses the now deprecated v3 of the Linode API. 
- Please review https://www.linode.com/api/linode for determining the required parameters. 
Examples
- name: Create a new Linode
  community.general.linode:
    name: linode-test1
    plan: 1
    datacenter: 7
    distribution: 129
    state: present
  register: linode_creation
- name: Create a server with a private IP Address
  community.general.linode:
    module: linode
    api_key: 'longStringFromLinodeApi'
    name: linode-test1
    plan: 1
    datacenter: 2
    distribution: 99
    password: 'superSecureRootPassword'
    private_ip: true
    ssh_pub_key: 'ssh-rsa qwerty'
    swap: 768
    wait: true
    wait_timeout: 600
    state: present
  delegate_to: localhost
  register: linode_creation
- name: Fully configure new server
  community.general.linode:
    api_key: 'longStringFromLinodeApi'
    name: linode-test1
    plan: 4
    datacenter: 2
    distribution: 99
    kernel_id: 138
    password: 'superSecureRootPassword'
    private_ip: true
    ssh_pub_key: 'ssh-rsa qwerty'
    swap: 768
    wait: true
    wait_timeout: 600
    state: present
    alert_bwquota_enabled: true
    alert_bwquota_threshold: 80
    alert_bwin_enabled: true
    alert_bwin_threshold: 10
    alert_cpu_enabled: true
    alert_cpu_threshold: 210
    alert_bwout_enabled: true
    alert_bwout_threshold: 10
    alert_diskio_enabled: true
    alert_diskio_threshold: 10000
    backupweeklyday: 1
    backupwindow: 2
    displaygroup: 'test'
    additional_disks:
      - {Label: 'disk1', Size: 2500, Type: 'raw'}
      - {Label: 'newdisk', Size: 2000}
    watchdog: true
  delegate_to: localhost
  register: linode_creation
- name: Ensure a running server (create if missing)
  community.general.linode:
    api_key: 'longStringFromLinodeApi'
    name: linode-test1
    plan: 1
    datacenter: 2
    distribution: 99
    password: 'superSecureRootPassword'
    ssh_pub_key: 'ssh-rsa qwerty'
    swap: 768
    wait: true
    wait_timeout: 600
    state: present
  delegate_to: localhost
  register: linode_creation
- name: Delete a server
  community.general.linode:
    api_key: 'longStringFromLinodeApi'
    name: linode-test1
    linode_id: "{{ linode_creation.instance.id }}"
    state: absent
  delegate_to: localhost
- name: Stop a server
  community.general.linode:
    api_key: 'longStringFromLinodeApi'
    name: linode-test1
    linode_id: "{{ linode_creation.instance.id }}"
    state: stopped
  delegate_to: localhost
- name: Reboot a server
  community.general.linode:
    api_key: 'longStringFromLinodeApi'
    name: linode-test1
    linode_id: "{{ linode_creation.instance.id }}"
    state: restarted
  delegate_to: localhost
