OpenStack multi cloud / user configurattion

Configure connections

# ~/.config/openstack/clouds.yaml
clouds:
  admin-dev:
    auth:
      auth_url: http://keystone-admin.dev.example.com:35357/v3
      project_name: admin
      username: admin
      user_domain_name: Default
      project_domain_name: Default
    interface: internal
 
  foo-stage:
    auth:
      auth_url: http://api.stage.example.com:35357
      project_name: fooproject
      username: foo
      user_domain_name: foodom
      project_domain_name: foodom
 
  dev-foo-bar-token:
    auth:
      auth_url: https://keystone.service.example.com/v3
    region_name: "az1"
    interface: "public"
    identity_api_version: 3
    project_domain_name: "foo-bar"
    project_name: "foo-bar-dev"
    auth_type: "v3token"

Configure passwords

# ~/.config/openstack/secure.yaml
clouds:
  admin-dev:
    auth:
      password: pass1234
 
  foo-stage:
    auth:
      password: pass1234
 
  dev-foo-bar-token:
    auth:
      token: "gAAAAABeNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Combine static clouds.yaml configuration and temporary token

export OS_TOKEN="gAAAAABeNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Test connection

openstack --os-cloud foo-stage image list

Configure default connection

export OS_CLOUD=foo-stage
openstack server list

Ansible

apt install -y python-shade

Links
https://docs.openstack.org/os-client-config/latest/user/configuration.html
https://docs.openstack.org/python-openstackclient/latest/configuration/index.html
https://docs.openstack.org/python-openstackclient/latest/cli/man/openstack.html