W3cubDocs

/Ansible

linode - create / delete / stop / restart an instance in Linode Public Cloud

New in version 1.3.

Synopsis

creates / deletes a Linode Public Cloud instance and optionally waits for it to be ‘running’.

Requirements (on host that executes module)

  • python >= 2.6
  • linode-python
  • pycurl

Options

parameter required default choices comments
api_key
no
Linode API key
datacenter
no
datacenter to create an instance in (Linode Datacenter)
distribution
no
distribution to use for the instance (Linode Distribution)
linode_id
no
Unique ID of a linode server
aliases: lid
name
no
Name to give the instance (alphanumeric, dashes, underscore)
To keep sanity on the Linode Web Console, name is prepended with LinodeID_
password
no
root password to apply to a new server (auto generated if missing)
payment_term
no 1
  • 1
  • 12
  • 24
payment term to use for the instance (payment term in months)
plan
no
plan to use for the instance (Linode plan)
ssh_pub_key
no
SSH public key applied to root user
state
no present
  • present
  • active
  • started
  • absent
  • deleted
  • stopped
  • restarted
Indicate desired state of the resource
swap
no 512
swap size in MB
wait
no no
  • yes
  • no
wait for the instance to be in state 'running' before returning
wait_timeout
no 300
how long before wait gives up, in seconds

Examples

# Create a server
- local_action:
     module: linode
     api_key: 'longStringFromLinodeApi'
     name: linode-test1
     plan: 1
     datacenter: 2
     distribution: 99
     password: 'superSecureRootPassword'
     ssh_pub_key: 'ssh-rsa qwerty'
     swap: 768
     wait: yes
     wait_timeout: 600
     state: present

# Ensure a running server (create if missing)
- local_action:
     module: 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

# Delete a server
- local_action:
     module: linode
     api_key: 'longStringFromLinodeApi'
     name: linode-test1
     linode_id: 12345678
     state: absent

# Stop a server
- local_action:
     module: linode
     api_key: 'longStringFromLinodeApi'
     name: linode-test1
     linode_id: 12345678
     state: stopped

# Reboot a server
- local_action:
     module: linode
     api_key: 'longStringFromLinodeApi'
     name: linode-test1
     linode_id: 12345678
     state: restarted

Notes

Note

LINODE_API_KEY env variable can be used instead

This is a Core Module

For more information on what this means please read Core Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/linode_module.html