salt.cloud.clouds.linode

Linode Cloud Module using Apache Libcloud OR linode-python bindings

The Linode cloud module is used to control access to the Linode VPS system

Use of this module only requires the apikey parameter.

Dependencies

linode-python OR apache-libcloud

linode-python

linode-python >= 1.1.1

SaltStack recommends installing linode-python if you're using a version of Python less than 2.7.9. You can install linode-python via pip:

pip install linode-python

Note

The linode-python driver will work with earlier versions of linode-python, but it is highly recommended to use a minimum version of 1.1.1. Earlier versions leak sensitive information into the debug logs.

** OR **

apache-libcloud

apache-libcloud >= 0.13.2

If your salt-cloud server runs on Python version 2.7.9 or Python >= 3.4, you can use the libcloud library to connect to Linode. For security reasons, Linode recently dropped support for TLSv1.0 and only supports TLS >= v1.1. Because of this reason, libcloud won't work for servers running older versions of Python or older versions of OpenSSL.

If your sever meets these requirements, you can install libcloud either via system packages or using pip:

pip install apache-libcloud

Note

RedHat/CentOS 7 backported the ssl stack from Python 2.7.9 to Python 2.7.5, so the libcloud library should work appropriately for those operating systems.

See Issue #30341 for more information.

Configuration

Set up the cloud configuration at /etc/salt/cloud.providers or /etc/salt/cloud.providers.d/linode.conf:

my-linode-config:
# Linode account api key apikey: JVkbSJDGHSDKUKSDJfhsdklfjgsjdkflhjlsdfffhgdgjkenrtuinv provider: linode

When used with linode-python, this provider supports cloning existing Linodes. To clone, add a profile with a clonefrom key, and a script_args: -C.

Clonefrom should be the name of the that is the source for the clone. script_args: -C passes a -C to the bootstrap script, which only configures the minion and doesn't try to install a new copy of salt-minion. This way the minion gets new keys and the keys get pre-seeded on the master, and the /etc/salt/minion file has the right 'id:' declaration.

Cloning requires a post 2015-02-01 salt-bootstrap.

class salt.cloud.clouds.linode.NodeAuthPassword(password, generated=False)

A password to be used for authentication to a node.

class salt.cloud.clouds.linode.NodeAuthSSHKey(pubkey)

An SSH key to be installed for authentication to a node. This is the actual contents of the users ssh public key which will normally be installed as root's public key on the node. >>> pubkey = '...' # read from file >>> from libcloud.compute.base import NodeAuthSSHKey >>> k = NodeAuthSSHKey(pubkey) >>> k <NodeAuthSSHKey>

salt.cloud.clouds.linode.boot(LinodeID=None, configid=None)

Execute a boot sequence on a linode

salt.cloud.clouds.linode.create(vm_)

Create a single VM from a data dict

salt.cloud.clouds.linode.create_config(vm_, LinodeID=None, root_disk_id=None, swap_disk_id=None)

Create a Linode Config

salt.cloud.clouds.linode.create_disk_from_distro(vm_=None, LinodeID=None, swapsize=None)

Create the disk for the linode

salt.cloud.clouds.linode.create_swap_disk(vm_=None, LinodeID=None, swapsize=None)

Create the disk for the linode

salt.cloud.clouds.linode.get_auth(vm_)

Return either NodeAuthSSHKey or NodeAuthPassword, preferring NodeAuthSSHKey if both are provided.

salt.cloud.clouds.linode.get_configured_provider()

Return the first configured instance.

salt.cloud.clouds.linode.get_conn()

Return a conn object for the passed VM data

salt.cloud.clouds.linode.get_kernels(conn=None)

Get Linode's list of kernels available

salt.cloud.clouds.linode.get_one_kernel(conn=None, name=None)

Return data on one kernel name=None returns latest kernel

salt.cloud.clouds.linode.get_password(vm_)

Return the password to use

salt.cloud.clouds.linode.get_private_ip(vm_)

Return True if a private ip address is requested

salt.cloud.clouds.linode.get_pubkey(vm_)

Return the SSH pubkey to use

salt.cloud.clouds.linode.get_ssh_key_filename(vm_)

Return path to filename if get_auth() returns a NodeAuthSSHKey.

salt.cloud.clouds.linode.get_swap(vm_)

Return the amount of swap space to use in MB

salt.cloud.clouds.linode.remove_complex_types(dictionary)

Linode-python is now returning some complex types that are not serializable by msgpack. Kill those.

salt.cloud.clouds.linode.waitfor_job(conn=None, LinodeID=None, JobID=None, timeout=300, quiet=True)
salt.cloud.clouds.linode.waitfor_status(conn=None, LinodeID=None, status=None, timeout=300, quiet=True)

Wait for a certain status