On this page
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 | 
|---|---|---|---|---|
| additional_disks 
        (added in 2.3)
         | 
      no | 
        
        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 
        (added in 2.3)
         | 
      no | 
       
  | 
      
        
        Set status of bandwidth in alerts.
         | 
     |
| alert_bwin_threshold 
        (added in 2.3)
         | 
      no | 
        
        Set threshold in MB of bandwidth in alerts.
         | 
     ||
| alert_bwout_enabled 
        (added in 2.3)
         | 
      no | 
       
  | 
      
        
        Set status of bandwidth out alerts.
         | 
     |
| alert_bwout_threshold 
        (added in 2.3)
         | 
      no | 
        
        Set threshold in MB of bandwidth out alerts.
         | 
     ||
| alert_bwquota_enabled 
        (added in 2.3)
         | 
      no | 
       
  | 
      
        
        Set status of bandwidth quota alerts as percentage of network transfer quota.
         | 
     |
| alert_bwquota_threshold 
        (added in 2.3)
         | 
      no | 
        
        Set threshold in MB of bandwidth quota alerts.
         | 
     ||
| alert_cpu_enabled 
        (added in 2.3)
         | 
      no | 
       
  | 
      
        
        Set status of receiving CPU usage alerts.
         | 
     |
| alert_cpu_threshold 
        (added in 2.3)
         | 
      no | 
        
        Set percentage threshold for receiving CPU usage alerts. Each CPU core adds 100% to total.
         | 
     ||
| alert_diskio_enabled 
        (added in 2.3)
         | 
      no | 
       
  | 
      
        
        Set status of receiving disk IO alerts.
         | 
     |
| alert_diskio_threshold 
        (added in 2.3)
         | 
      no | 
        
        Set threshold for average IO ops/sec over 2 hour period.
         | 
     ||
| api_key | 
      no | 
        
        Linode API key
         | 
     ||
| backupweeklyday 
        (added in 2.3)
         | 
      no | 
        
        Integer value for what day of the week to store weekly backups.
         | 
     ||
| datacenter | 
      no | 
        
        datacenter to create an instance in (Linode Datacenter)
         | 
     ||
| displaygroup 
        (added in 2.3)
         | 
      no | 
        
        Add the instance to a Display Group in Linode Manager
         | 
     ||
| distribution | 
      no | 
        
        distribution to use for the instance (Linode Distribution)
         | 
     ||
| kernel_id 
        (added in 2.4)
         | 
      no | 
        
        kernel to use for the instance (Linode Kernel)
         | 
     ||
| 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 | 
       
  | 
      
        
        payment term to use for the instance (payment term in months)
         | 
     
| plan | 
      no | 
        
        plan to use for the instance (Linode plan)
         | 
     ||
| private_ip 
        (added in 2.3)
         | 
      no | no | 
       
  | 
      
        
        Add private IPv4 address when Linode is created.
         | 
     
| ssh_pub_key | 
      no | 
        
        SSH public key applied to root user
         | 
     ||
| state | 
      no | present | 
       
  | 
      
        
        Indicate desired state of the resource
         | 
     
| swap | 
      no | 512 | 
        
        swap size in MB
         | 
     |
| wait | 
      no | no | 
       
  | 
      
        
        wait for the instance to be in state 'running' before returning
         | 
     
| wait_timeout | 
      no | 300 | 
        
        how long before wait gives up, in seconds
         | 
     |
| watchdog 
        (added in 2.2)
         | 
      no | True | 
       
  | 
      
        
        Set status of Lassie watchdog.
         | 
     
Examples
# Create a server with a private IP Address
- local_action:
     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
# Fully configure new server
- local_action:
     module: 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_diskio_enabled: True
     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
# 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
 
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/2.4/linode_module.html