Important Kolla-ansible commands for managing OpenStack deployment

Share this article

In Kolla Ansible deploying OpenStack wallaby on Ubuntu 20.04 [part-1], we saw how easily Kolla-ansible commands is used to deploy OpenStack in a given environment.

Kolla-ansible provides many commands which are very useful for managing the OpenStack deployment. In this blog, we will look into different options on how Kolla-ansible can be used in a more appropriate way.

Lets see what options and commands we can use with kolla-ansible.

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible -h
Usage: /home/ubuntu/wallaby/bin/kolla-ansible COMMAND [options]

Options:
    --inventory, -i <inventory_path>   Specify path to ansible inventory file
    --playbook, -p <playbook_path>     Specify path to ansible playbook file
    --configdir <config_path>          Specify path to directory with globals.yml
    --key -k <key_path>                Specify path to ansible vault keyfile
    --help, -h                         Show this usage information
    --tags, -t <tags>                  Only run plays and tasks tagged with these values
    --skip-tags <tags>                 Only run plays and tasks whose tags do not match these values
    --extra, -e <ansible variables>    Set additional variables as key=value or YAML/JSON passed to ansible-playbook
    --passwords <passwords_path>       Specify path to the passwords file
    --limit <host>                     Specify host to run plays
    --forks <forks>                    Number of forks to run Ansible with
    --vault-id <@prompt or path>       Specify @prompt or password file (Ansible >=  2.4)
    --ask-vault-pass                   Ask for vault password
    --vault-password-file <path>       Specify password file for vault decrypt
    --verbose, -v                      Increase verbosity of ansible-playbook

Environment variables:
    EXTRA_OPTS                         Additional arguments to pass to ansible-playbook

Commands:
    prechecks            Do pre-deployment checks for hosts
    check                Do post-deployment smoke tests
    mariadb_recovery     Recover a completely stopped mariadb cluster
    mariadb_backup       Take a backup of MariaDB databases
                             --full (default)
                             --incremental
    monasca_cleanup      Remove unused containers for the Monasca service
    bootstrap-servers    Bootstrap servers with kolla deploy dependencies
    destroy              Destroy Kolla containers, volumes and host configuration
                             --include-images to also destroy Kolla images
                             --include-dev to also destroy dev mode repos
    deploy               Deploy and start all kolla containers
    deploy-bifrost       Deploy and start bifrost container
    deploy-servers       Enroll and deploy servers with bifrost
    deploy-containers    Only deploy and start containers (no config updates or bootstrapping)
    post-deploy          Do post deploy on deploy node
    pull                 Pull all images for containers (only pulls, no running container changes)
    reconfigure          Reconfigure OpenStack service
    stop                 Stop Kolla containers
    certificates         Generate self-signed certificate for TLS *For Development Only*
    octavia-certificates Generate certificates for octavia deployment
    upgrade              Upgrades existing OpenStack Environment
    upgrade-bifrost      Upgrades an existing bifrost container
    genconfig            Generate configuration files for enabled OpenStack services
    prune-images         Prune orphaned Kolla images
    chrony-cleanup       Clean up disabled chrony containers
(wallaby) ubuntu@ubuntu-exp:~$ 


Now we will try to look at important commands and try to give examples.

Inventrory file

In all commands we will see -i INVENTORY argument. It is basically path to our inventory file which contains information about our hosts. Where we want to deploy the OpenStack and what project goes on which hosts. There are two files one is multinode and all-in-one

  • multinode: it is used when you want to deploy OpenStack more than one host.
  • all-in-one: as name suffice that this is used for OpenStack deployment in one host.

In Kolla Ansible deploying OpenStack wallaby on Ubuntu 20.04, we have used an all-in-one inventory file. Here we will use this as an example in all the commands.

kolla-ansible -i INVENTORY deploy

 It is used to deploy all the projects in the containers and it automatically starts all Kolla containers.

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible  -i /etc/kolla/all-in-one deploy 

You can also deploy only one project with a tag option, see in the following example. Also, with a comma, we can mention more than one project as -t argument.

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible  -i /etc/kolla/all-in-one deploy -t keystone

kolla-ansible -i INVENTORY destroy

 This command is used to delete containers and volumes in the OpenStack deployment. Be care full with this command it cleans up everything even configurational files inside /etc/kolla/

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible  -i /etc/kolla/all-in-one destroy  --yes-i-really-really-mean-it

kolla-ansible -i INVENTORY mariadb_recovery

This command is used to recover MariaDB cluster. Even if you delete your container you can recover your MariaDB cluster, the only important thing here is don’t remove MariaDB volume.

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible  -i /etc/kolla/all-in-one mariadb_recovery

kolla-ansible -i INVENTORY prechecks

Before deployment, this command ensures that all the necessary packages, dependencies, and all access rights are provided for the deployment.

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible  -i /etc/kolla/all-in-one prechecks

kolla-ansible post-deploy

This command is used to get admin-openrc.sh file. This file contains the admin password, project and many important environment variables to manage the Openstack environment. Here in the following example, the last part of the command is used where you want to place your admin-openrc.sh file.

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible post-deploy  /etc/kolla/admin-openrc.sh

kolla-ansible pull

This command is used to pull docker images of Openstack projects which will be used later to create containers from these images.

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible pull

kolla-ansible -i INVENTORY reconfigure

This command is the most important command because this command will be used constantly, when you are running OpenStack you will be adding new projects changing configuration now and then.

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible  -i /etc/kolla/all-in-one reconfigure 

You can also reconfigure one project with a tag option, see in the following example. Also, with a comma, you can mention more than one project as -t argument.

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible  -i /etc/kolla/all-in-one deploy -t keystone,nova

kolla-ansible upgrade

Used to upgrade kolla-ansible

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible  upgrade

kolla-ansible -i INVENTORY stop

This will stop all deployed kolla containers, limit with tags is possible and also with skip_stop_containers variable. To confirm, please add the following option: –yes-i-really-really-mean-it

(wallaby) ubuntu@ubuntu-exp:~$ kolla-ansible  -i /etc/kolla/all-in-one stop -t nova --yes-i-really-really-mean-it 

See the output in the following screenshot. You can see all the containers of nova is stopped.

References:
https://docs.openstack.org/kolla-ansible/latest/user/operating-kolla.html

Leave a Comment

Your email address will not be published. Required fields are marked *