openstack-manuals/doc/user-guide/section_cli_heat.xml
Mike Spreitzer 50300bdd40 Added pointers to template documentation.
Also added "Heat Orchestration Template" and "Stack"
to the glossary.

Also made a few other changes suggested by reviewers.

Change-Id: I9856f9664cc104eda7a37d9a0a43ee1a0e534aca
Closes-Bug: 1281691
2014-03-24 16:32:21 -04:00

133 lines
8.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:html="http://www.w3.org/1999/xhtml" version="5.0"
xml:id="heat-stack-create">
<?dbhtml stop-chunking?>
<title>Create and manage stacks</title>
<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>
<procedure>
<step>
<para>To create a stack, or template, from an <link
xlink:href="https://github.com/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>
</step>
<step>
<para>You can also use the
<command>stack-create</command> command to
validate a template file without creating a stack
from it.</para>
<para>To do so, 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></screen>
<para>If validation fails, the response returns an
error message.</para>
</step>
</procedure>
</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.</para>
<para>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 the specified resource
in a stack, run the following command:</para>
<screen><prompt>$</prompt> <userinput>heat resource-show mystack WikiDatabase</userinput></screen>
<para>Some resources have associated metadata which
can change throughout the life-cycle of a
resource:</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.</para>
<para>To display life-cycle events, run:</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>
<procedure xml:id="heat-stack-update">
<step>
<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>
</step>
</procedure>
</section>
</section>