openstack-manuals/doc/user-guide/section_cli_heat.xml
Christian Berendt c4c2f82d1f Use git.openstack.org instead of github.com
Replace github.com names with git.openstack.org since git.openstack.org
is the master.

Changes relevant occurrences in the following documents:

* admin-guide-cloud
* common
* install-guide
* user-guide

Change-Id: Ic3da4d2b07b00cee492597d00dfac5f38b1a22ab
2015-02-27 10:40:13 +01:00

139 lines
9.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="5.0"
xml:id="heat-stack-create">
<?dbhtml stop-chunking?>
<title>Create and manage stacks</title>
<para>The Orchestration module enables you to orchestrate multiple composite cloud applications.
This module supports use of both the Amazon Web Services (AWS) CloudFormation template
format through both a Query API that is compatible with CloudFormation and the native
OpenStack <glossterm>Heat Orchestration Template (HOT)</glossterm> format through a REST
API.</para>
<para>These flexible template languages
enable application developers to describe and automate the deployment of infrastructure,
services, and applications. The templates enable creation of most OpenStack resource types,
such as instances, floating IP addresses, volumes, security groups, and users. The
resources, once created, are referred to as stacks.</para>
<para>The template languages are described
in <link xlink:href="http://docs.openstack.org/developer/heat/template_guide/index.html">the
Template Guide</link> in the <link
xlink:href="http://docs.openstack.org/developer/heat/">Heat developer
documentation</link>.</para>
<section xml:id="create_stack">
<title>Create a stack from an example template file</title>
<itemizedlist>
<listitem>
<para>To create a stack, or template, from an <link
xlink:href="http://git.openstack.org/cgit/openstack/heat-templates"
>example template file</link>, run the following
command:</para>
<screen><prompt>$</prompt> <userinput>heat stack-create mystack --template-file /<replaceable>PATH_TO_HEAT_TEMPLATES</replaceable>/WordPress_Single_Instance.template</userinput>
<userinput>--parameters "InstanceType=m1.large;DBUsername=<replaceable>USERNAME</replaceable>;DBPassword=<replaceable>PASSWORD</replaceable>;KeyName=<replaceable>HEAT_KEY</replaceable>;LinuxDistribution=F17"</userinput></screen>
<para>The <literal>--parameters</literal> values that
you specify depend on the parameters that are defined
in the template. If a website hosts the template file, you can specify the URL with the
<literal>--template-url</literal> parameter
instead of the <literal>--template-file</literal>
parameter.</para>
<para>The command returns the following output:</para>
<screen><computeroutput>+--------------------------------------+---------------+--------------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+---------------+--------------------+----------------------+
| 4c712026-dcd5-4664-90b8-0915494c1332 | mystack | CREATE_IN_PROGRESS | 2013-04-03T23:22:08Z |
+--------------------------------------+---------------+--------------------+----------------------+</computeroutput></screen>
</listitem>
<listitem>
<para>You can also use the
<command>template-validate</command> command
to validate a template file without creating a
stack from it.</para>
<note><para>Previous versions of the heat client
used <command>validate</command> instead of
<command>template-validate</command>, but
it has been deprecated in favor of
<command>template-validate</command>.
</para></note>
<para>To do so, run the following command:</para>
<screen><prompt>$</prompt> <userinput>heat template-validate --template-file /<replaceable>PATH_TO_HEAT_TEMPLATES</replaceable>/WordPress_Single_Instance.template</userinput></screen>
<para>If validation fails, the response returns an
error message.</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="stack_info">
<title>Get information about stacks</title>
<para>To explore the state and history of a particular stack,
you can run a number of commands.</para>
<itemizedlist>
<listitem>
<para>To see which stacks are visible to the current
user, run the following command:</para>
<screen><prompt>$</prompt> <userinput>heat stack-list</userinput>
<computeroutput>+--------------------------------------+---------------+-----------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+---------------+-----------------+----------------------+
| 4c712026-dcd5-4664-90b8-0915494c1332 | mystack | CREATE_COMPLETE | 2013-04-03T23:22:08Z |
| 7edc7480-bda5-4e1c-9d5d-f567d3b6a050 | my-otherstack | CREATE_FAILED | 2013-04-03T23:28:20Z |
+--------------------------------------+---------------+-----------------+----------------------+</computeroutput></screen>
</listitem>
<listitem>
<para>To show the details of a stack, run the
following command:</para>
<screen><prompt>$</prompt> <userinput>heat stack-show mystack</userinput></screen>
</listitem>
<listitem>
<para>A stack consists of a collection of resources. To list the resources and their
status, run the following command:</para>
<screen><prompt>$</prompt> <userinput>heat resource-list mystack</userinput>
<computeroutput>+---------------------+--------------------+-----------------+----------------------+
| logical_resource_id | resource_type | resource_status | updated_time |
+---------------------+--------------------+-----------------+----------------------+
| WikiDatabase | AWS::EC2::Instance | CREATE_COMPLETE | 2013-04-03T23:25:56Z |
+---------------------+--------------------+-----------------+----------------------+</computeroutput></screen>
</listitem>
<listitem>
<para>To show the details for a specific resource in a stack, run the following
command:</para>
<screen><prompt>$</prompt> <userinput>heat resource-show mystack WikiDatabase</userinput></screen></listitem>
<listitem><para>Some resources have associated metadata which can change throughout the life cycle of a
resource. Show the metadata by running the following command:</para>
<screen><prompt>$</prompt> <userinput>heat resource-metadata mystack WikiDatabase</userinput></screen>
</listitem>
<listitem>
<para>A series of events is generated during the life cycle of a stack. To display
life cycle events, run the following command::</para>
<screen><prompt>$</prompt> <userinput>heat event-list mystack</userinput>
<computeroutput>+---------------------+----+------------------------+-----------------+----------------------+
| logical_resource_id | id | resource_status_reason | resource_status | event_time |
+---------------------+----+------------------------+-----------------+----------------------+
| WikiDatabase | 1 | state changed | IN_PROGRESS | 2013-04-03T23:22:09Z |
| WikiDatabase | 2 | state changed | CREATE_COMPLETE | 2013-04-03T23:25:56Z |
+---------------------+----+------------------------+-----------------+----------------------+</computeroutput></screen>
</listitem>
<listitem>
<para>To show the details for a particular event, run
the following command:</para>
<screen><prompt>$</prompt> <userinput>heat event-show WikiDatabase 1</userinput></screen>
</listitem>
</itemizedlist>
</section>
<section xml:id="update_stack">
<title>Update a stack</title>
<para>To update an existing stack from a modified
template file, run a command like the following
command:</para>
<screen><prompt>$</prompt> <userinput>heat stack-update mystack --template-file /path/to/heat/templates/WordPress_Single_Instance_v2.template</userinput>
<userinput>--parameters "InstanceType=m1.large;DBUsername=wp;DBPassword=verybadpassword;KeyName=heat_key;LinuxDistribution=F17"</userinput>
<computeroutput>+--------------------------------------+---------------+-----------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+---------------+-----------------+----------------------+
| 4c712026-dcd5-4664-90b8-0915494c1332 | mystack | UPDATE_COMPLETE | 2013-04-03T23:22:08Z |
| 7edc7480-bda5-4e1c-9d5d-f567d3b6a050 | my-otherstack | CREATE_FAILED | 2013-04-03T23:28:20Z |
+--------------------------------------+---------------+-----------------+----------------------+</computeroutput></screen>
<para>Some resources are updated in-place, while
others are replaced with new resources.</para>
</section>
</section>