2015-06-17 22:41:03 +00:00
=============================
2014-12-11 15:51:43 +00:00
Getting Started With HP Cloud
2015-06-17 22:41:03 +00:00
=============================
2014-03-11 17:18:28 +00:00
2014-12-11 15:51:43 +00:00
HP Cloud is a major public cloud platform and uses the libcloud
2014-03-11 17:18:28 +00:00
`openstack` driver. The current version of OpenStack that HP Cloud
2014-12-11 15:51:43 +00:00
uses is Havana. When an instance is booted, it must have a
floating IP added to it in order to connect to it and further below
2014-03-11 17:18:28 +00:00
you will see an example that adds context to this statement.
2014-03-20 19:35:07 +00:00
Set up a cloud provider configuration file
==========================================
2014-03-17 22:17:18 +00:00
2014-12-11 15:51:43 +00:00
To use the `openstack` driver for HP Cloud, set up the cloud
provider configuration file as in the example shown below:
2014-03-24 16:12:56 +00:00
`` /etc/salt/cloud.providers.d/hpcloud.conf `` :
2014-03-11 17:18:28 +00:00
.. code-block :: yaml
hpcloud-config:
# Set the location of the salt-master
#
minion:
master: saltmaster.example.com
# Configure HP Cloud using the OpenStack plugin
#
identity_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens
2014-12-11 15:51:43 +00:00
compute_name: Compute
2014-03-11 17:18:28 +00:00
protocol: ipv4
# Set the compute region:
#
2014-12-11 15:51:43 +00:00
compute_region: region-b.geo-1
2014-03-11 17:18:28 +00:00
# Configure HP Cloud authentication credentials
#
user: myname
2014-12-11 15:51:43 +00:00
tenant: myname-project1
2014-03-11 17:18:28 +00:00
password: xxxxxxxxx
# keys to allow connection to the instance launched
#
ssh_key_name: yourkey
ssh_key_file: /path/to/key/yourkey.priv
2015-06-17 22:41:03 +00:00
driver: openstack
2014-03-11 17:18:28 +00:00
The subsequent example that follows is using the openstack driver.
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.
2014-03-11 17:18:28 +00:00
Compute Region
==============
Originally, HP Cloud, in its OpenStack Essex version (1.0), had 3
2014-12-11 15:51:43 +00:00
availability zones in one region, US West (region-a.geo-1), which
each behaved each as a region.
2014-03-11 19:59:32 +00:00
2014-12-11 15:51:43 +00:00
This has since changed, and the current OpenStack Havana version of
2014-03-11 17:18:28 +00:00
HP Cloud (1.1) now has simplified this and now has two regions to choose from:
.. code-block :: bash
2014-12-11 15:51:43 +00:00
region-a.geo-1 -> US West
2014-03-11 19:59:32 +00:00
region-b.geo-1 -> US East
2014-03-11 17:18:28 +00:00
Authentication
==============
The `` user `` is the same user as is used to log into the HP Cloud management
2014-12-11 15:51:43 +00:00
UI. The `` tenant `` can be found in the upper left under "Project/Region/Scope".
2014-03-11 17:18:28 +00:00
It is often named the same as `` user `` albeit with a `` -project1 `` appended.
The `` password `` is of course what you created your account with. The management
2014-03-11 19:59:32 +00:00
UI also has other information such as being able to select US East or US West.
2014-03-11 17:18:28 +00:00
2014-03-20 19:35:07 +00:00
Set up a cloud profile config file
==================================
2014-03-11 17:18:28 +00:00
The profile shown below is a know working profile for an Ubuntu instance. The
profile configuration file is stored in the following location:
`` /etc/salt/cloud.profiles.d/hp_ae1_ubuntu.conf `` :
.. code-block :: yaml
hp_ae1_ubuntu:
2014-12-11 15:51:43 +00:00
provider: hp_ae1
image: 9302692b-b787-4b52-a3a6-daebb79cb498
2014-03-11 17:18:28 +00:00
ignore_cidr: 10.0.0.1/24
networks:
- floating: Ext-Net
size: standard.small
ssh_key_file: /root/keys/test.key
ssh_key_name: test
ssh_username: ubuntu
Some important things about the example above:
2014-03-11 19:59:32 +00:00
* 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):
2014-03-11 17:18:28 +00:00
2014-12-11 15:51:43 +00:00
.. code-block :: bash
2014-03-11 17:18:28 +00:00
# salt-cloud --list-images hp_ae1
2014-12-11 15:51:43 +00:00
* 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.
2014-03-11 17:18:28 +00:00
2014-12-11 15:51:43 +00:00
* 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.
2014-03-11 17:18:28 +00:00
* 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
2014-12-11 15:51:43 +00:00
* 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
2014-03-11 17:18:28 +00:00
2014-12-11 15:51:43 +00:00
Launch an instance
2014-03-20 19:35:07 +00:00
==================
2014-03-11 17:18:28 +00:00
To instantiate a machine based on this profile (example):
.. code-block :: bash
# salt-cloud -p hp_ae1_ubuntu ubuntu_instance_1
After several minutes, this will create an instance named ubuntu_instance_1
2014-12-11 15:51:43 +00:00
running in HP Cloud in the US East region and will set up the minion and then
2014-03-11 17:18:28 +00:00
return information about the instance once completed.
2014-12-11 15:51:43 +00:00
Manage the instance
2014-03-20 19:35:07 +00:00
===================
2014-12-11 15:51:43 +00:00
Once the instance has been created with salt-minion installed, connectivity to
2014-03-11 17:18:28 +00:00
it can be verified with Salt:
.. code-block :: bash
# salt ubuntu_instance_1 ping
2014-03-20 19:35:07 +00:00
SSH to the instance
===================
2014-04-30 20:55:30 +00:00
Additionally, the instance can be accessed via SSH using the floating IP assigned to it
2014-03-11 17:18:28 +00:00
.. code-block :: bash
# ssh ubuntu@<floating ip>
2014-03-20 19:35:07 +00:00
Using a private IP
==================
2014-04-30 20:55:30 +00:00
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)
2014-03-20 19:35:07 +00:00
The example below is a modified version of the previous example. Note the use of `` ssh_interface `` :
.. code-block :: yaml
hp_ae1_ubuntu:
2014-12-11 15:51:43 +00:00
provider: hp_ae1
image: 9302692b-b787-4b52-a3a6-daebb79cb498
2014-03-20 19:35:07 +00:00
size: standard.small
ssh_key_file: /root/keys/test.key
ssh_key_name: test
ssh_username: ubuntu
ssh_interface: private_ips
2015-08-10 15:20:26 +00:00
With this setup, salt-cloud will use the private IP address to ssh into the instance and set up the salt-minion