openstack-manuals/doc/common/section_cli_keystone_exampl...

39 lines
2.7 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="example-usage">
<title>keystone command-line client example usage</title>
<para>Before you can use keystone client commands, you must
download and source an OpenStack RC file. For information, see
the <citetitle>OpenStack Admin User Guide</citetitle>.</para>
<para>The keystone command-line client uses the following
syntax:</para>
<screen><prompt>$</prompt> <userinput>keystone <replaceable>PARAMETER</replaceable> <replaceable>COMMAND</replaceable> <replaceable>ARGUMENT</replaceable></userinput></screen>
<para>For example, you can run the <command>user-list</command>
and <command>tenant-create</command> commands, as
follows:</para>
<screen><computeroutput># Using OS_SERVICE_ENDPOINT and OS_SERVICE_TOKEN environment variables</computeroutput>
<prompt>$</prompt> <userinput>export OS_SERVICE_ENDPOINT=http://127.0.0.1:5000/v2.0/</userinput>
<prompt>$</prompt> <userinput>export OS_SERVICE_TOKEN=secrete_token</userinput>
<prompt>$</prompt> <userinput>keystone user-list</userinput>
<prompt>$</prompt> <userinput>keystone tenant-create --name demo</userinput>
<computeroutput># Using --os-token and os-endpoint parameters</computeroutput>
<prompt>$</prompt> <userinput>keystone --os-token <replaceable>token</replaceable> --os-endpoint <replaceable>endpoint</replaceable> user-list</userinput>
<prompt>$</prompt> <userinput>keystone --os-token <replaceable>token</replaceable> --os-endpoint <replaceable>endpoint</replaceable> tenant-create --name demo</userinput>
<computeroutput># Using OS_USERNAME, OS_PASSWORD, and OS_TENANT_NAME environment variables</computeroutput>
<prompt>$</prompt> <userinput>export OS_USERNAME=admin</userinput>
<prompt>$</prompt> <userinput>export OS_PASSWORD=secrete</userinput>
<prompt>$</prompt> <userinput>export OS_TENANT_NAME=admin</userinput>
<prompt>$</prompt> <userinput>keystone user-list</userinput>
<prompt>$</prompt> <userinput>keystone tenant-create --name demo</userinput>
<computeroutput># Using tenant_id parameter</computeroutput>
<prompt>$</prompt> <userinput>keystone user-list --tenant_id <replaceable>id</replaceable></userinput>
<computeroutput># Using --name, --description, and --enabled parameters</computeroutput>
<prompt>$</prompt> <userinput>keystone tenant-create --name demo --description "demo tenant" --enabled true</userinput></screen>
<para>For information about using the keystone client commands to
create and manage users, roles, and projects, see the
<citetitle>OpenStack Admin User Guide</citetitle>.</para>
</section>