List All Application Stack And Tenants in OpenStack Region

Problem

How to list all the application stack for the corresponding username and its tenants for an OpenStack region?

Environment

  • Platform9 Managed OpenStack - All Versions

  • OpenStack Unified CLI

Procedure

Follow the below steps to gather the requested information:

  1. Source the admin RC file for your environment.

$ source [your_rc_file].rc
  1. Run the below script to capture data for region provided in the source file.

# Give +x permission to the script before executing.# Run this bash script on each tenant.echo -e "Application \t\t\t User \t\t\t Tenant"for name in $(openstack stack list --all | awk '{print$2}' | egrep -v ID) do stack_name=$(openstack stack show $name -c stack_name -f value 2> /dev/null) if [[ $stack_name ]]; then stack_user=$(openstack stack show $name | grep spg_adid | awk '{printf$4}') stack_tenant=$(openstack stack show $name -c outputs | egrep -A1 "pf9_tenant" | egrep "output_value" | awk '{printf$4}') echo -e "${stack_name} \t ${stack_user} \t ${stack_tenant}" fi done

Additional Information

You can refer the community documentation for more details on openstack CLI options.