Documentation

linode - Manage instances on the Linode Public Cloud

New in version 1.3.

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.

  • python >= 2.6
  • linode-python

Parameters

Parameter Choices/Defaults Comments
additional_disks
(added in 2.3)
List of dictionaries for creating additional disks that are added to the Linode configuration settings.
Dictionary takes Size, Label, Type. Size is in MB.
alert_bwin_enabled
bool

(added in 2.3)
    Choices:
  • no
  • yes
Set status of bandwidth in alerts.
alert_bwin_threshold
(added in 2.3)
Set threshold in MB of bandwidth in alerts.
alert_bwout_enabled
bool

(added in 2.3)
    Choices:
  • no
  • yes
Set status of bandwidth out alerts.
alert_bwout_threshold
(added in 2.3)
Set threshold in MB of bandwidth out alerts.
alert_bwquota_enabled
bool

(added in 2.3)
    Choices:
  • no
  • yes
Set status of bandwidth quota alerts as percentage of network transfer quota.
alert_bwquota_threshold
(added in 2.3)
Set threshold in MB of bandwidth quota alerts.
alert_cpu_enabled
bool

(added in 2.3)
    Choices:
  • no
  • yes
Set status of receiving CPU usage alerts.
alert_cpu_threshold
(added in 2.3)
Set percentage threshold for receiving CPU usage alerts. Each CPU core adds 100% to total.
alert_diskio_enabled
bool

(added in 2.3)
    Choices:
  • no
  • yes
Set status of receiving disk IO alerts.
alert_diskio_threshold
(added in 2.3)
Set threshold for average IO ops/sec over 2 hour period.
api_key
Linode API key
backupweeklyday
(added in 2.3)
Integer value for what day of the week to store weekly backups.
datacenter
datacenter to create an instance in (Linode Datacenter)
displaygroup
(added in 2.3)
Add the instance to a Display Group in Linode Manager.
distribution
distribution to use for the instance (Linode Distribution)
kernel_id
(added in 2.4)
kernel to use for the instance (Linode Kernel)
linode_id
Unique ID of a linode server

aliases: lid
name
required
Name to give the instance (alphanumeric, dashes, underscore).
To keep sanity on the Linode Web Console, name is prepended with LinodeID_.
password
root password to apply to a new server (auto generated if missing)
payment_term
    Choices:
  • 1 ←
  • 12
  • 24
payment term to use for the instance (payment term in months)
plan
plan to use for the instance (Linode plan)
private_ip
bool

(added in 2.3)
    Choices:
  • no ←
  • yes
Add private IPv4 address when Linode is created.
ssh_pub_key
SSH public key applied to root user
state
    Choices:
  • absent
  • active
  • deleted
  • present ←
  • restarted
  • started
  • stopped
Indicate desired state of the resource
swap Default:
512
swap size in MB
wait
bool
    Choices:
  • no ←
  • yes
wait for the instance to be in state running before returning
wait_timeout Default:
300
how long before wait gives up, in seconds
watchdog
bool

(added in 2.2)
    Choices:
  • no
  • yes ←
Set status of Lassie watchdog.

Notes

Note

Examples

- name: Create a server with a private IP Address
  linode:
     module: linode
     api_key: 'longStringFromLinodeApi'
     name: linode-test1
     plan: 1
     datacenter: 2
     distribution: 99
     password: 'superSecureRootPassword'
     private_ip: yes
     ssh_pub_key: 'ssh-rsa qwerty'
     swap: 768
     wait: yes
     wait_timeout: 600
     state: present
  delegate_to: localhost

- name: Fully configure new server
  linode:
     api_key: 'longStringFromLinodeApi'
     name: linode-test1
     plan: 4
     datacenter: 2
     distribution: 99
     kernel_id: 138
     password: 'superSecureRootPassword'
     private_ip: yes
     ssh_pub_key: 'ssh-rsa qwerty'
     swap: 768
     wait: yes
     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

- name: Ensure a running server (create if missing)
  linode:
     api_key: 'longStringFromLinodeApi'
     name: linode-test1
     linode_id: 12345678
     plan: 1
     datacenter: 2
     distribution: 99
     password: 'superSecureRootPassword'
     ssh_pub_key: 'ssh-rsa qwerty'
     swap: 768
     wait: yes
     wait_timeout: 600
     state: present
  delegate_to: localhost

- name: Delete a server
  linode:
     api_key: 'longStringFromLinodeApi'
     name: linode-test1
     linode_id: 12345678
     state: absent
  delegate_to: localhost

- name: Stop a server
  linode:
     api_key: 'longStringFromLinodeApi'
     name: linode-test1
     linode_id: 12345678
     state: stopped
  delegate_to: localhost

- name: Reboot a server
  linode:
     api_key: 'longStringFromLinodeApi'
     name: linode-test1
     linode_id: 12345678
     state: restarted
  delegate_to: localhost

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Vincent Viallet (@zbal)

Hint

If you notice any issues in this documentation you can edit this document to improve it.