1
0

linode.rst 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. ===========================
  2. Getting Started With Linode
  3. ===========================
  4. Linode is a public cloud host with a focus on Linux instances.
  5. Starting with the 2015.8.0 release of Salt, the Linode driver uses Linode's
  6. native REST API. There are no external dependencies required to use the
  7. Linode driver, other than a Linode account.
  8. Provider Configuration
  9. ======================
  10. Linode requires a single API key, but the default root password for new
  11. instances also needs to be set. The password needs to be eight characters
  12. and contain lowercase, uppercase, and numbers.
  13. Set up the provider cloud configuration file at ``/etc/salt/cloud.providers`` or
  14. ``/etc/salt/cloud.providers.d/*.conf``.
  15. .. code-block:: yaml
  16. my-linode-config:
  17. apikey: 'asldkgfakl;sdfjsjaslfjaklsdjf;askldjfaaklsjdfhasldsadfghdkf'
  18. password: 'F00barbaz'
  19. driver: linode
  20. .. note::
  21. .. versionchanged:: 2015.8.0
  22. The ``provider`` parameter in cloud provider definitions was renamed to ``driver``. This
  23. change was made to avoid confusion with the ``provider`` parameter that is used in cloud profile
  24. definitions. Cloud provider definitions now use ``driver`` to refer to the Salt cloud module that
  25. provides the underlying functionality to connect to a cloud host, while cloud profiles continue
  26. to use ``provider`` to refer to provider configurations that you define.
  27. Profile Configuration
  28. =====================
  29. Linode profiles require a ``provider``, ``size``, ``image``, and ``location``. Set up an initial profile
  30. at ``/etc/salt/cloud.profiles`` or ``/etc/salt/cloud.profiles.d/*.conf``:
  31. .. code-block:: yaml
  32. linode_1024:
  33. provider: my-linode-config
  34. size: Linode 2GB
  35. image: CentOS 7
  36. location: London, England, UK
  37. The profile can be realized now with a salt command:
  38. .. code-block:: bash
  39. salt-cloud -p linode_1024 linode-instance
  40. This will create an salt minion instance named ``linode-instance`` in Linode. If the command was
  41. executed on the salt-master, its Salt key will automatically be signed on the master.
  42. Once the instance has been created with a salt-minion installed, connectivity to
  43. it can be verified with Salt:
  44. .. code-block:: bash
  45. salt linode-instance test.version
  46. Listing Sizes
  47. -------------
  48. Sizes can be obtained using the ``--list-sizes`` option for the ``salt-cloud``
  49. command:
  50. .. code-block:: bash
  51. # salt-cloud --list-sizes my-linode-config
  52. my-linode-config:
  53. ----------
  54. linode:
  55. ----------
  56. Linode 2GB:
  57. ----------
  58. AVAIL:
  59. ----------
  60. 10:
  61. 500
  62. 11:
  63. 500
  64. 2:
  65. 500
  66. 3:
  67. 500
  68. 4:
  69. 500
  70. 6:
  71. 500
  72. 7:
  73. 500
  74. 8:
  75. 500
  76. 9:
  77. 500
  78. CORES:
  79. 1
  80. DISK:
  81. 50
  82. HOURLY:
  83. 0.015
  84. LABEL:
  85. Linode 2GB
  86. PLANID:
  87. 2
  88. PRICE:
  89. 10.0
  90. RAM:
  91. 2048
  92. XFER:
  93. 2000
  94. ...SNIP...
  95. Listing Images
  96. --------------
  97. Images can be obtained using the ``--list-images`` option for the ``salt-cloud``
  98. command:
  99. .. code-block:: bash
  100. # salt-cloud --list-images my-linode-config
  101. my-linode-config:
  102. ----------
  103. linode:
  104. ----------
  105. Arch Linux 2015.02:
  106. ----------
  107. CREATE_DT:
  108. 2015-02-20 14:17:16.0
  109. DISTRIBUTIONID:
  110. 138
  111. IS64BIT:
  112. 1
  113. LABEL:
  114. Arch Linux 2015.02
  115. MINIMAGESIZE:
  116. 800
  117. REQUIRESPVOPSKERNEL:
  118. 1
  119. ...SNIP...
  120. Listing Locations
  121. -----------------
  122. Locations can be obtained using the ``--list-locations`` option for the ``salt-cloud``
  123. command:
  124. .. code-block:: bash
  125. # salt-cloud --list-locations my-linode-config
  126. my-linode-config:
  127. ----------
  128. linode:
  129. ----------
  130. Atlanta, GA, USA:
  131. ----------
  132. ABBR:
  133. atlanta
  134. DATACENTERID:
  135. 4
  136. LOCATION:
  137. Atlanta, GA, USA
  138. ...SNIP...
  139. Linode Specific Settings
  140. ========================
  141. There are several options outlined below that can be added to either the Linode
  142. provider of profile configuration files. Some options are mandatory and are
  143. properly labeled below but typically also include a hard-coded default.
  144. image
  145. -----
  146. Image is used to define what Operating System image should be used for the
  147. instance. Examples are ``Ubuntu 14.04 LTS`` and ``CentOS 7``. This option should
  148. be specified in the profile config. Required.
  149. location
  150. --------
  151. Location is used to define which Linode data center the instance will reside in.
  152. Required.
  153. size
  154. ----
  155. Size is used to define the instance's "plan type" which includes memory, storage,
  156. and price. Required.
  157. assign_private_ip
  158. -----------------
  159. .. versionadded:: 2016.3.0
  160. Assigns a private IP address to a Linode when set to True. Default is False.
  161. ssh_interface
  162. -------------
  163. .. versionadded:: 2016.3.0
  164. Specify whether to use a public or private IP for the deploy script. Valid options
  165. are:
  166. * public_ips: The salt-master is hosted outside of Linode. Default.
  167. * private_ips: The salt-master is also hosted within Linode.
  168. If specifying ``private_ips``, the Linodes must be hosted within the same data
  169. center and have the Network Helper enabled on your entire account. The instance
  170. that is running the Salt-Cloud provisioning command must also have a private IP
  171. assigned to it.
  172. Newer accounts created on Linode have the Network Helper setting enabled by default,
  173. account-wide. Legacy accounts do not have this setting enabled by default. To enable
  174. the Network Helper on your Linode account, please see `Linode's Network Helper`_
  175. documentation.
  176. If you're running into problems, be sure to restart the instance that is running
  177. Salt Cloud after adding its own private IP address or enabling the Network
  178. Helper.
  179. .. _Linode's Network Helper: https://www.linode.com/docs/platform/network-helper
  180. clonefrom
  181. ---------
  182. Setting the clonefrom option to a specified instance enables the new instance to be
  183. cloned from the named instance instead of being created from scratch. If using the
  184. clonefrom option, it is likely a good idea to also specify ``script_args: -C`` if a
  185. minion is already installed on the to-be-cloned instance. See the `Cloning`_ section
  186. below for more information.
  187. Cloning
  188. =======
  189. To clone a Linode, add a profile with a ``clonefrom`` key, and a ``script_args: -C``.
  190. ``clonefrom`` should be the name of the Linode that is the source for the clone.
  191. ``script_args: -C`` passes a -C to the salt-bootstrap script, which only configures
  192. the minion and doesn't try to install a new copy of salt-minion. This way the minion
  193. gets new keys and the keys get pre-seeded on the master, and the ``/etc/salt/minion``
  194. file has the right minion 'id:' declaration.
  195. Cloning requires a post 2015-02-01 salt-bootstrap.
  196. It is safest to clone a stopped machine. To stop a machine run
  197. .. code-block:: bash
  198. salt-cloud -a stop machine_to_clone
  199. To create a new machine based on another machine, add an entry to your linode
  200. cloud profile that looks like this:
  201. .. code-block:: yaml
  202. li-clone:
  203. provider: my-linode-config
  204. clonefrom: machine_to_clone
  205. script_args: -C -F
  206. Then run salt-cloud as normal, specifying ``-p li-clone``. The profile name can
  207. be anything; It doesn't have to be ``li-clone``.
  208. ``clonefrom:`` is the name of an existing machine in Linode from which to clone.
  209. ``Script_args: -C -F`` is necessary to avoid re-deploying Salt via salt-bootstrap.
  210. ``-C`` will just re-deploy keys so the new minion will not have a duplicate key
  211. or minion_id on the Master, and ``-F`` will force a rewrite of the Minion config
  212. file on the new Minion. If ``-F`` isn't provided, the new Minion will have the
  213. ``machine_to_clone``'s Minion ID, instead of its own Minion ID, which can cause
  214. problems.
  215. .. note::
  216. `Pull Request #733`_ to the salt-bootstrap repo makes the ``-F`` argument
  217. non-necessary. Once that change is released into a stable version of the
  218. Bootstrap Script, the ``-C`` argument will be sufficient for the ``script_args``
  219. setting.
  220. .. _Pull Request #733: https://github.com/saltstack/salt-bootstrap/pull/733
  221. If the ``machine_to_clone`` does not have Salt installed on it, refrain from using
  222. the ``script_args: -C -F`` altogether, because the new machine will need to have
  223. Salt installed.