1
0

hpcloud.rst 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. =============================
  2. Getting Started With HP Cloud
  3. =============================
  4. HP Cloud is a major public cloud platform and uses the libcloud
  5. `openstack` driver. The current version of OpenStack that HP Cloud
  6. uses is Havana. When an instance is booted, it must have a
  7. floating IP added to it in order to connect to it and further below
  8. you will see an example that adds context to this statement.
  9. Set up a cloud provider configuration file
  10. ==========================================
  11. To use the `openstack` driver for HP Cloud, set up the cloud
  12. provider configuration file as in the example shown below:
  13. ``/etc/salt/cloud.providers.d/hpcloud.conf``:
  14. .. code-block:: yaml
  15. hpcloud-config:
  16. # Set the location of the salt-master
  17. #
  18. minion:
  19. master: saltmaster.example.com
  20. # Configure HP Cloud using the OpenStack plugin
  21. #
  22. identity_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens
  23. compute_name: Compute
  24. protocol: ipv4
  25. # Set the compute region:
  26. #
  27. compute_region: region-b.geo-1
  28. # Configure HP Cloud authentication credentials
  29. #
  30. user: myname
  31. tenant: myname-project1
  32. password: xxxxxxxxx
  33. # keys to allow connection to the instance launched
  34. #
  35. ssh_key_name: yourkey
  36. ssh_key_file: /path/to/key/yourkey.priv
  37. driver: openstack
  38. The subsequent example that follows is using the openstack driver.
  39. .. note::
  40. .. versionchanged:: 2015.8.0
  41. The ``provider`` parameter in cloud provider definitions was renamed to ``driver``. This
  42. change was made to avoid confusion with the ``provider`` parameter that is used in cloud profile
  43. definitions. Cloud provider definitions now use ``driver`` to refer to the Salt cloud module that
  44. provides the underlying functionality to connect to a cloud host, while cloud profiles continue
  45. to use ``provider`` to refer to provider configurations that you define.
  46. Compute Region
  47. ==============
  48. Originally, HP Cloud, in its OpenStack Essex version (1.0), had 3
  49. availability zones in one region, US West (region-a.geo-1), which
  50. each behaved each as a region.
  51. This has since changed, and the current OpenStack Havana version of
  52. HP Cloud (1.1) now has simplified this and now has two regions to choose from:
  53. .. code-block:: bash
  54. region-a.geo-1 -> US West
  55. region-b.geo-1 -> US East
  56. Authentication
  57. ==============
  58. The ``user`` is the same user as is used to log into the HP Cloud management
  59. UI. The ``tenant`` can be found in the upper left under "Project/Region/Scope".
  60. It is often named the same as ``user`` albeit with a ``-project1`` appended.
  61. The ``password`` is of course what you created your account with. The management
  62. UI also has other information such as being able to select US East or US West.
  63. Set up a cloud profile config file
  64. ==================================
  65. The profile shown below is a know working profile for an Ubuntu instance. The
  66. profile configuration file is stored in the following location:
  67. ``/etc/salt/cloud.profiles.d/hp_ae1_ubuntu.conf``:
  68. .. code-block:: yaml
  69. hp_ae1_ubuntu:
  70. provider: hp_ae1
  71. image: 9302692b-b787-4b52-a3a6-daebb79cb498
  72. ignore_cidr: 10.0.0.1/24
  73. networks:
  74. - floating: Ext-Net
  75. size: standard.small
  76. ssh_key_file: /root/keys/test.key
  77. ssh_key_name: test
  78. ssh_username: ubuntu
  79. Some important things about the example above:
  80. * The ``image`` parameter can use either the image name or image ID which you can obtain by running in the example below (this case US East):
  81. .. code-block:: bash
  82. # salt-cloud --list-images hp_ae1
  83. * The parameter ``ignore_cidr`` specifies a range of addresses to ignore when trying to connect to the instance. In this case, it's the range of IP addresses used for an private IP of the instance.
  84. * The parameter ``networks`` is very important to include. In previous versions of Salt Cloud, this is what made it possible for salt-cloud to be able to attach a floating IP to the instance in order to connect to the instance and set up the minion. The current version of salt-cloud doesn't require it, though having it is of no harm either. Newer versions of salt-cloud will use this, and without it, will attempt to find a list of floating IP addresses to use regardless.
  85. * The ``ssh_key_file`` and ``ssh_key_name`` are the keys that will make it possible to connect to the instance to set up the minion
  86. * The ``ssh_username`` parameter, in this case, being that the image used will be ubuntu, will make it possible to not only log in but install the minion
  87. Launch an instance
  88. ==================
  89. To instantiate a machine based on this profile (example):
  90. .. code-block:: bash
  91. # salt-cloud -p hp_ae1_ubuntu ubuntu_instance_1
  92. After several minutes, this will create an instance named ubuntu_instance_1
  93. running in HP Cloud in the US East region and will set up the minion and then
  94. return information about the instance once completed.
  95. Manage the instance
  96. ===================
  97. Once the instance has been created with salt-minion installed, connectivity to
  98. it can be verified with Salt:
  99. .. code-block:: bash
  100. # salt ubuntu_instance_1 ping
  101. SSH to the instance
  102. ===================
  103. Additionally, the instance can be accessed via SSH using the floating IP assigned to it
  104. .. code-block:: bash
  105. # ssh ubuntu@<floating ip>
  106. Using a private IP
  107. ==================
  108. Alternatively, in the cloud profile, using the private IP to log into the instance to set up the minion is another option, particularly if salt-cloud is running within the cloud on an instance that is on the same network with all the other instances (minions)
  109. The example below is a modified version of the previous example. Note the use of ``ssh_interface``:
  110. .. code-block:: yaml
  111. hp_ae1_ubuntu:
  112. provider: hp_ae1
  113. image: 9302692b-b787-4b52-a3a6-daebb79cb498
  114. size: standard.small
  115. ssh_key_file: /root/keys/test.key
  116. ssh_key_name: test
  117. ssh_username: ubuntu
  118. ssh_interface: private_ips
  119. With this setup, salt-cloud will use the private IP address to ssh into the instance and set up the salt-minion