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
      #token: gAAAAABjpLjOVEzH3YEf70Lc0VoIDZlTnaQ1pUPllNAJ
    region_name: "az1"
    interface: "public"
    identity_api_version: 3
    project_domain_name: "foo"
    project_name: "bar"
    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=$(openstack token issue -f value -c id)

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/python-openstackclient/pike/configuration/index.html
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