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

Author:Vincent Viallet

Synopsis

New in version 1.3.

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

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
          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

                      Note

                      Requires linode-python

                      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
                      

                      Note

                      LINODE_API_KEY env variable can be used instead