|
| 1 | +# OpenStack Getting Started with CLI |
| 2 | + |
| 3 | +After you have installed the OpenStack command-line tools, you can proceed with initializing your account. This guide will show you how to run a command with an unscoped and scoped token to set up your account. |
| 4 | + |
| 5 | +!!! note |
| 6 | + |
| 7 | + This document makes the assumption that your account has the `OPENSTACK_FLEX` role assigned to it. If you do not have the `OPENSTACK_FLEX` role, you may not be permitted access to the environment. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +1. Ensure you have the OpenStack command-line tools installed. If not, follow the instructions in the [Openstack Deploying the Command Line Tools](openstack-deploy-cli.md) documentation. |
| 12 | +2. Obtain your OpenStack credentials: **username**, **password**, and **domain**. |
| 13 | +3. Obtain the authentication URL. |
| 14 | + |
| 15 | +## Authenticating with OpenStack |
| 16 | + |
| 17 | +Before you can run OpenStack commands, you need to authenticate using your OpenStack credentials. This involves obtaining an unscoped token and then using it to get a scoped token. |
| 18 | + |
| 19 | +### Step 1: Obtain your projects |
| 20 | + |
| 21 | +To obtain a list of our available projects, we'll need to run a command with an unscoped token. Unscoped tokens are used to identify a user but does not define an association with a project. |
| 22 | + |
| 23 | +!!! note |
| 24 | + |
| 25 | + This step authenticates you with the OpenStack Identity service (Keystone) and is required for first time access to the environment. |
| 26 | + |
| 27 | +Run the following command, replacing the placeholders with your actual OpenStack credentials: |
| 28 | + |
| 29 | +``` shell |
| 30 | +openstack project list --os-auth-url ${AUTH_URL} \ |
| 31 | + --os-username ${USERNAME} \ |
| 32 | + --os-password ${PASSWORD} \ |
| 33 | + --os-user-domain-name ${DOMAIN_NAME} |
| 34 | +``` |
| 35 | + |
| 36 | +> Replace the placeholders with your actual credentials and project name. |
| 37 | +
|
| 38 | +This command returns a list of your available projects, the returned information will be used to in later commands |
| 39 | + |
| 40 | +### Step 2: Obtain a Scoped Token |
| 41 | + |
| 42 | +A scoped token is associated with a specific project and is used to perform actions within that project. |
| 43 | + |
| 44 | +Run the following command to obtain a scoped token: |
| 45 | + |
| 46 | +``` shell |
| 47 | +openstack token issue --os-auth-url ${AUTH_URL} \ |
| 48 | + --os-username ${USERNAME} \ |
| 49 | + --os-password ${PASSWORD} \ |
| 50 | + --os-user-domain-name ${DOMAIN_NAME} \ |
| 51 | + --os-project-domain-name ${DOMAIN_NAME} \ |
| 52 | + --os-project-name ${PROJECT_NAME} |
| 53 | +``` |
| 54 | + |
| 55 | +This command returns a scoped token that you will use for subsequent OpenStack commands. |
| 56 | + |
| 57 | +## Running an OpenStack Command |
| 58 | + |
| 59 | +With your scoped token, you can now run OpenStack commands. For example, to list the available flavors, use: |
| 60 | + |
| 61 | +``` shell |
| 62 | +openstack flavor list --os-auth-url ${AUTH_URL} \ |
| 63 | + --os-username ${USERNAME} \ |
| 64 | + --os-password ${PASSWORD} \ |
| 65 | + --os-user-domain-name ${DOMAIN_NAME} \ |
| 66 | + --os-project-domain-name ${DOMAIN_NAME} \ |
| 67 | + --os-project-name ${PROJECT_NAME} |
| 68 | +``` |
| 69 | + |
| 70 | +This command lists all flavors available to your project. |
| 71 | + |
| 72 | +## Further Reading |
| 73 | + |
| 74 | +For more detailed information on OpenStack command-line interface and authentication, refer to the [our documentation](openstack-clouds.md) for creating your `clouds.yaml`. |
| 75 | + |
| 76 | +By following these steps, you should be able to initialize your account and start using the OpenStack CLI. |
0 commit comments