2015-10-05 12:35:59 +13:00
|
|
|
..
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
not use this file except in compliance with the License. You may obtain
|
|
|
|
a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
License for the specific language governing permissions and limitations
|
|
|
|
under the License.
|
|
|
|
|
|
|
|
.. _create-a-stack:
|
|
|
|
|
|
|
|
Creating your first stack
|
|
|
|
=========================
|
|
|
|
|
|
|
|
Confirming you can access a Heat endpoint
|
|
|
|
-----------------------------------------
|
|
|
|
|
|
|
|
Before any Heat commands can be run, your cloud credentials need to be
|
|
|
|
sourced::
|
|
|
|
|
|
|
|
$ source openrc
|
|
|
|
|
|
|
|
You can confirm that Heat is available with this command::
|
|
|
|
|
2016-12-22 11:56:17 +08:00
|
|
|
$ openstack stack list
|
2015-10-05 12:35:59 +13:00
|
|
|
|
|
|
|
This should return an empty line
|
|
|
|
|
|
|
|
Preparing to create a stack
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
Your cloud will have different flavors and images available for
|
|
|
|
launching instances, you can discover what is available by running::
|
|
|
|
|
|
|
|
$ openstack flavor list
|
|
|
|
$ openstack image list
|
|
|
|
|
|
|
|
|
|
|
|
To allow you to SSH into instances launched by Heat, a keypair will be
|
|
|
|
generated::
|
|
|
|
|
|
|
|
$ openstack keypair create heat_key > heat_key.priv
|
|
|
|
$ chmod 600 heat_key.priv
|
|
|
|
|
|
|
|
Launching a stack
|
|
|
|
-----------------
|
|
|
|
Now lets launch a stack, using an example template from the heat-templates repository::
|
|
|
|
|
2016-12-22 11:56:17 +08:00
|
|
|
$ openstack stack create -t http://git.openstack.org/cgit/openstack/heat-templates/plain/hot/F20/WordPress_Native.yaml --parameter key_name=heat_key --parameter image_id=my-fedora-image --parameter instance_type=m1.small teststack
|
2015-10-05 12:35:59 +13:00
|
|
|
|
|
|
|
Which will respond::
|
|
|
|
|
|
|
|
+--------------------------------------+-----------+--------------------+----------------------+
|
|
|
|
| ID | Name | Status | Created |
|
|
|
|
+--------------------------------------+-----------+--------------------+----------------------+
|
|
|
|
| (uuid) | teststack | CREATE_IN_PROGRESS | (timestamp) |
|
|
|
|
+--------------------------------------+-----------+--------------------+----------------------+
|
|
|
|
|
2016-02-08 08:53:32 -05:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
Link on Heat template presented in command above should reference on RAW
|
|
|
|
template. In case if it be a "html" page with template, Heat will return
|
|
|
|
an error.
|
|
|
|
|
2015-10-05 12:35:59 +13:00
|
|
|
List stacks
|
|
|
|
~~~~~~~~~~~
|
|
|
|
List the stacks in your tenant::
|
|
|
|
|
2016-12-22 11:56:17 +08:00
|
|
|
$ openstack stack list
|
2015-10-05 12:35:59 +13:00
|
|
|
|
|
|
|
List stack events
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
List the events related to a particular stack::
|
|
|
|
|
2016-12-22 11:56:17 +08:00
|
|
|
$ openstack stack event list teststack
|
2015-10-05 12:35:59 +13:00
|
|
|
|
|
|
|
Describe the wordpress stack
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Show detailed state of a stack::
|
|
|
|
|
2016-12-22 11:56:17 +08:00
|
|
|
$ openstack stack show teststack
|
2015-10-05 12:35:59 +13:00
|
|
|
|
|
|
|
Note: After a few seconds, the stack_status should change from ``IN_PROGRESS``
|
|
|
|
to ``CREATE_COMPLETE``.
|
|
|
|
|
|
|
|
Verify instance creation
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Because the software takes some time to install from the repository, it may be
|
|
|
|
a few minutes before the Wordpress instance is in a running state.
|
|
|
|
|
|
|
|
Point a web browser at the location given by the ``WebsiteURL`` output as shown
|
2016-12-22 11:56:17 +08:00
|
|
|
by ``openstack stack output show``::
|
2015-10-05 12:35:59 +13:00
|
|
|
|
2016-12-22 11:56:17 +08:00
|
|
|
$ WebsiteURL=$(openstack stack output show teststack WebsiteURL -c output_value -f value)
|
2015-10-05 12:35:59 +13:00
|
|
|
$ curl $WebsiteURL
|
|
|
|
|
|
|
|
Delete the instance when done
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Note: The list operation will show no running stack.::
|
|
|
|
|
2016-12-22 11:56:17 +08:00
|
|
|
$ openstack stack delete teststack
|
|
|
|
$ openstack stack list
|
2015-10-05 12:35:59 +13:00
|
|
|
|
2016-02-03 13:18:17 +05:30
|
|
|
You can explore other heat commands by referring to the
|
2015-10-05 12:35:59 +13:00
|
|
|
`Heat chapter
|
2016-01-16 17:44:54 +01:00
|
|
|
<http://docs.openstack.org/cli-reference/heat.html>`_
|
2015-10-05 12:35:59 +13:00
|
|
|
of the `OpenStack Command-Line Interface Reference
|
2016-01-16 17:44:54 +01:00
|
|
|
<http://docs.openstack.org/cli-reference/index.html>`_ then read
|
2015-10-05 12:35:59 +13:00
|
|
|
the :ref:`template-guide` and start authoring your own templates.
|