2013-11-22 18:37:19 +00:00
|
|
|
===========================
|
|
|
|
Getting Started With Linode
|
|
|
|
===========================
|
|
|
|
|
2015-08-10 15:20:26 +00:00
|
|
|
Linode is a public cloud host with a focus on Linux instances.
|
2013-11-22 18:37:19 +00:00
|
|
|
|
2015-07-08 17:17:01 +00:00
|
|
|
Starting with the 2015.8.0 release of Salt, the Linode driver uses Linode's
|
2015-06-19 22:17:56 +00:00
|
|
|
native REST API. There are no external dependencies required to use the
|
2015-10-02 18:06:05 +00:00
|
|
|
Linode driver, other than a Linode account.
|
2015-02-28 19:23:22 +00:00
|
|
|
|
2015-10-02 18:06:05 +00:00
|
|
|
|
|
|
|
Provider Configuration
|
|
|
|
======================
|
2014-12-11 15:51:43 +00:00
|
|
|
Linode requires a single API key, but the default root password for new
|
2015-10-02 18:06:05 +00:00
|
|
|
instances also needs to be set. The password needs to be eight characters
|
|
|
|
and contain lowercase, uppercase, and numbers.
|
2013-11-22 18:37:19 +00:00
|
|
|
|
2015-10-02 18:06:05 +00:00
|
|
|
Set up the provider cloud configuration file at ``/etc/salt/cloud.providers`` or
|
|
|
|
``/etc/salt/cloud.providers.d/*.conf``.
|
2013-11-22 18:37:19 +00:00
|
|
|
|
2015-10-02 18:06:05 +00:00
|
|
|
.. code-block:: yaml
|
2013-11-22 18:37:19 +00:00
|
|
|
|
|
|
|
my-linode-config:
|
2015-10-02 18:06:05 +00:00
|
|
|
apikey: 'asldkgfakl;sdfjsjaslfjaklsdjf;askldjfaaklsjdfhasldsadfghdkf'
|
|
|
|
password: 'F00barbaz'
|
2015-06-17 22:41:03 +00:00
|
|
|
driver: linode
|
2013-11-22 18:37:19 +00:00
|
|
|
|
2015-08-10 15:20:26 +00:00
|
|
|
.. note::
|
|
|
|
.. versionchanged:: 2015.8.0
|
|
|
|
|
|
|
|
The ``provider`` parameter in cloud provider definitions was renamed to ``driver``. This
|
|
|
|
change was made to avoid confusion with the ``provider`` parameter that is used in cloud profile
|
|
|
|
definitions. Cloud provider definitions now use ``driver`` to refer to the Salt cloud module that
|
|
|
|
provides the underlying functionality to connect to a cloud host, while cloud profiles continue
|
|
|
|
to use ``provider`` to refer to provider configurations that you define.
|
|
|
|
|
2013-11-22 18:37:19 +00:00
|
|
|
|
2015-10-02 18:06:05 +00:00
|
|
|
Profile Configuration
|
|
|
|
=====================
|
|
|
|
Linode profiles require a ``provider``, ``size``, ``image``, and ``location``. Set up an initial profile
|
|
|
|
at ``/etc/salt/cloud.profiles`` or in the ``/etc/salt/cloud.profiles.d/`` directory:
|
2013-11-22 18:37:19 +00:00
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
linode_1024:
|
|
|
|
provider: my-linode-config
|
2016-01-21 00:05:20 +00:00
|
|
|
size: Linode 2048
|
|
|
|
image: CentOS 7
|
|
|
|
location: London, England, UK
|
2015-10-02 18:06:05 +00:00
|
|
|
|
|
|
|
The profile can be realized now with a salt command:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt-cloud -p linode_1024 linode-instance
|
|
|
|
|
|
|
|
This will create an salt minion instance named ``linode-instance`` in Linode. If the command was
|
|
|
|
executed on the salt-master, its Salt key will automatically be signed on the master.
|
2013-11-22 18:37:19 +00:00
|
|
|
|
2015-10-02 18:06:05 +00:00
|
|
|
Once the instance has been created with a salt-minion installed, connectivity to
|
|
|
|
it can be verified with Salt:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt linode-instance test.ping
|
|
|
|
|
|
|
|
|
|
|
|
Listing Sizes
|
|
|
|
-------------
|
2013-11-22 18:37:19 +00:00
|
|
|
Sizes can be obtained using the ``--list-sizes`` option for the ``salt-cloud``
|
|
|
|
command:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
# salt-cloud --list-sizes my-linode-config
|
|
|
|
my-linode-config:
|
|
|
|
----------
|
|
|
|
linode:
|
|
|
|
----------
|
|
|
|
Linode 1024:
|
|
|
|
----------
|
2015-10-02 18:06:05 +00:00
|
|
|
AVAIL:
|
|
|
|
----------
|
|
|
|
10:
|
|
|
|
500
|
|
|
|
2:
|
|
|
|
500
|
|
|
|
3:
|
|
|
|
500
|
|
|
|
4:
|
|
|
|
500
|
|
|
|
6:
|
|
|
|
500
|
|
|
|
7:
|
|
|
|
500
|
|
|
|
8:
|
|
|
|
500
|
|
|
|
9:
|
|
|
|
500
|
|
|
|
CORES:
|
2013-11-22 18:37:19 +00:00
|
|
|
1
|
2015-10-02 18:06:05 +00:00
|
|
|
DISK:
|
|
|
|
24
|
|
|
|
HOURLY:
|
|
|
|
0.015
|
|
|
|
LABEL:
|
2013-11-22 18:37:19 +00:00
|
|
|
Linode 1024
|
|
|
|
...SNIP...
|
|
|
|
|
2015-10-02 18:06:05 +00:00
|
|
|
|
|
|
|
Listing Images
|
|
|
|
--------------
|
2013-11-22 18:37:19 +00:00
|
|
|
Images can be obtained using the ``--list-images`` option for the ``salt-cloud``
|
|
|
|
command:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
# salt-cloud --list-images my-linode-config
|
|
|
|
my-linode-config:
|
|
|
|
----------
|
|
|
|
linode:
|
|
|
|
----------
|
2015-10-02 18:06:05 +00:00
|
|
|
Arch Linux 2015.02:
|
2013-11-22 18:37:19 +00:00
|
|
|
----------
|
2015-10-02 18:06:05 +00:00
|
|
|
CREATE_DT:
|
|
|
|
2015-02-20 14:17:16.0
|
|
|
|
DISTRIBUTIONID:
|
|
|
|
138
|
|
|
|
IS64BIT:
|
|
|
|
1
|
|
|
|
LABEL:
|
|
|
|
Arch Linux 2015.02
|
|
|
|
MINIMAGESIZE:
|
|
|
|
800
|
|
|
|
REQUIRESPVOPSKERNEL:
|
|
|
|
1
|
2013-11-22 18:37:19 +00:00
|
|
|
...SNIP...
|
2015-02-28 19:23:22 +00:00
|
|
|
|
|
|
|
|
2015-10-02 18:06:05 +00:00
|
|
|
Listing Locations
|
|
|
|
-----------------
|
2015-06-17 15:43:08 +00:00
|
|
|
Locations can be obtained using the ``--list-locations`` option for the ``salt-cloud``
|
|
|
|
command:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
# salt-cloud --list-locations my-linode-config
|
|
|
|
my-linode-config:
|
|
|
|
----------
|
|
|
|
linode:
|
|
|
|
----------
|
|
|
|
Atlanta, GA, USA:
|
|
|
|
----------
|
2015-10-02 18:06:05 +00:00
|
|
|
ABBR:
|
2015-06-17 15:43:08 +00:00
|
|
|
atlanta
|
2015-10-02 18:06:05 +00:00
|
|
|
DATACENTERID:
|
2015-06-17 15:43:08 +00:00
|
|
|
4
|
2015-10-02 18:06:05 +00:00
|
|
|
LOCATION:
|
|
|
|
Atlanta, GA, USA
|
2015-06-17 15:43:08 +00:00
|
|
|
...SNIP...
|
|
|
|
|
|
|
|
|
2015-10-02 18:06:05 +00:00
|
|
|
Linode Specific Settings
|
|
|
|
========================
|
|
|
|
There are several options outlined below that can be added to either the Linode
|
|
|
|
provider of profile configuration files. Some options are mandatory and are
|
|
|
|
properly labeled below but typically also include a hard-coded default.
|
|
|
|
|
|
|
|
image
|
|
|
|
-----
|
|
|
|
Image is used to define what Operating System image should be used for the
|
|
|
|
instance. Examples are ``Ubuntu 14.04 LTS`` and ``CentOS 7``. This option should
|
|
|
|
be specified in the profile config. Required.
|
|
|
|
|
|
|
|
location
|
|
|
|
--------
|
|
|
|
Location is used to define which Linode data center the instance will reside in.
|
|
|
|
Required.
|
|
|
|
|
|
|
|
size
|
|
|
|
----
|
|
|
|
Size is used to define the instance's "plan type" which includes memory, storage,
|
|
|
|
and price. Required.
|
|
|
|
|
|
|
|
assign_private_ip
|
|
|
|
-----------------
|
2016-02-10 22:45:28 +00:00
|
|
|
.. versionadded:: 2016.3.0
|
2015-10-02 18:06:05 +00:00
|
|
|
|
|
|
|
Assigns a private IP address to a Linode when set to True. Default is False.
|
|
|
|
|
|
|
|
ssh_interface
|
|
|
|
-------------
|
2016-02-10 22:45:28 +00:00
|
|
|
.. versionadded:: 2016.3.0
|
2015-10-02 18:06:05 +00:00
|
|
|
|
|
|
|
Specify whether to use a public or private IP for the deploy script. Valid options
|
|
|
|
are:
|
|
|
|
|
|
|
|
* public_ips: The salt-master is hosted outside of Linode. Default.
|
|
|
|
* private_ips: The salt-master is also hosted within Linode.
|
|
|
|
|
|
|
|
If specifying ``private_ips``, the Linodes must be hosted within the same data
|
2015-10-02 18:30:19 +00:00
|
|
|
center and have the Network Helper enabled on your entire account. The instance
|
|
|
|
that is running the Salt-Cloud provisioning command must also have a private IP
|
|
|
|
assigned to it.
|
2015-10-02 18:06:05 +00:00
|
|
|
|
|
|
|
Newer accounts created on Linode have the Network Helper setting enabled by default,
|
2015-10-02 18:30:19 +00:00
|
|
|
account-wide. Legacy accounts do not have this setting enabled by default. To enable
|
|
|
|
the Network Helper on your Linode account, please see `Linode's Network Helper`_
|
|
|
|
documentation.
|
|
|
|
|
|
|
|
If you're running into problems, be sure to restart the instance that is running
|
|
|
|
Salt Cloud after adding its own private IP address or enabling the Network
|
|
|
|
Helper.
|
2015-10-02 18:06:05 +00:00
|
|
|
|
|
|
|
.. _Linode's Network Helper: https://www.linode.com/docs/platform/network-helper
|
|
|
|
|
|
|
|
clonefrom
|
|
|
|
---------
|
|
|
|
Setting the clonefrom option to a specified instance enables the new instance to be
|
|
|
|
cloned from the named instance instead of being created from scratch. If using the
|
|
|
|
clonefrom option, it is likely a good idea to also specify ``script_args: -C`` if a
|
|
|
|
minion is already installed on the to-be-cloned instance. See the `Cloning`_ section
|
|
|
|
below for more information.
|
|
|
|
|
|
|
|
|
2015-02-28 19:23:22 +00:00
|
|
|
Cloning
|
|
|
|
=======
|
2015-10-02 18:06:05 +00:00
|
|
|
To clone a Linode, add a profile with a ``clonefrom`` key, and a ``script_args: -C``.
|
|
|
|
``clonefrom`` should be the name of the Linode that is the source for the clone.
|
|
|
|
``script_args: -C`` passes a -C to the salt-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 minion 'id:' declaration.
|
2015-02-28 19:23:22 +00:00
|
|
|
|
2015-10-02 18:06:05 +00:00
|
|
|
Cloning requires a post 2015-02-01 salt-bootstrap.
|
2015-02-28 19:23:22 +00:00
|
|
|
|
2015-06-19 22:15:13 +00:00
|
|
|
It is safest to clone a stopped machine. To stop a machine run
|
2015-02-28 19:23:22 +00:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt-cloud -a stop machine_to_clone
|
|
|
|
|
|
|
|
To create a new machine based on another machine, add an entry to your linode
|
|
|
|
cloud profile that looks like this:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
li-clone:
|
2015-06-17 22:41:03 +00:00
|
|
|
provider: my-linode-config
|
2015-02-28 19:23:22 +00:00
|
|
|
clonefrom: machine_to_clone
|
2016-01-21 00:05:20 +00:00
|
|
|
script_args: -C -F
|
2015-02-28 19:23:22 +00:00
|
|
|
|
2016-01-21 00:05:20 +00:00
|
|
|
Then run salt-cloud as normal, specifying ``-p li-clone``. The profile name can
|
|
|
|
be anything; It doesn't have to be ``li-clone``.
|
2015-02-28 19:23:22 +00:00
|
|
|
|
2016-01-21 00:05:20 +00:00
|
|
|
``clonefrom:`` is the name of an existing machine in Linode from which to clone.
|
|
|
|
``Script_args: -C -F`` is necessary to avoid re-deploying Salt via salt-bootstrap.
|
|
|
|
``-C`` will just re-deploy keys so the new minion will not have a duplicate key
|
|
|
|
or minion_id on the Master, and ``-F`` will force a rewrite of the Minion config
|
|
|
|
file on the new Minion. If ``-F`` isn't provided, the new Minion will have the
|
|
|
|
``machine_to_clone``'s Minion ID, instead of its own Minion ID, which can cause
|
|
|
|
problems.
|
2015-02-28 19:23:22 +00:00
|
|
|
|
2016-01-21 00:05:20 +00:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
`Pull Request #733`_ to the salt-bootstrap repo makes the ``-F`` argument
|
|
|
|
non-necessary. Once that change is released into a stable version of the
|
|
|
|
Bootstrap Script, the ``-C`` argument will be sufficient for the ``script_args``
|
|
|
|
setting.
|
|
|
|
|
|
|
|
.. _Pull Request #733: https://github.com/saltstack/salt-bootstrap/pull/733
|
2016-01-21 17:29:48 +00:00
|
|
|
|
|
|
|
If the ``machine_to_clone`` does not have Salt installed on it, refrain from using
|
|
|
|
the ``script_args: -C -F`` altogether, because the new machine will need to have
|
|
|
|
Salt installed.
|