OpenStack CLI
Installation
The easiest way to install the OpenStack CLI is to utilize your OS packages. But if you want to install it manually you will need to already have Python on your system.
# create Python virtualenv at $HOME/.openstack
python -m venv $HOME/.openstack
# install the tools
$HOME/.openstack/bin/pip install python-openstackclient 'python-ironicclient[cli]'
# create a binary wrapper to the virtualenv
mkdir -p $HOME/.bin
cat <<- "EOF" > $HOME/.bin/openstack
#!/bin/sh
source $HOME/.openstack/bin/activate
exec $HOME/.openstack/bin/openstack "$@"
EOF
chmod +x $HOME/.bin/openstack
# add it to our PATH
export PATH="$HOME/.bin:$PATH"
# make sure we always have it
cat <<- "EOF" >> $HOME/.bashrc
export PATH="$HOME/.bin:$PATH"
EOF
Configuration
The easiest way to configure your client is via clouds.yaml
.
$HOME/.config/openstack/clouds.yaml
clouds:
understack:
auth:
auth_url: https://your.endpoint.url/v3
user_domain_name: mydomain
username: myuser
password: mypass
project_domain_name: mydomain
project_name: myproject
region_name:
- MyRegion
interface: public
identity_api_version: 3
With the above configuration in $HOME/.config/openstack/clouds.yaml
you
will be able to run the OpenStack CLI as follows:
Or you can set the OS_CLOUD
environment variable once and shorten the
command as follows: