os-client-config

Monty Taylor

http://inaugust.com/talks/os-client-config.html

twitter: @e_monty

I'm awash in cloud accounts

  • Infra has 5
    • control plane and nodepool in 3 Rackspace regions
    • control plane and nodepool in HP
  • two personal on HP and one on Rackspace
  • two internal HP accounts
  • That's 12 OpenStack cloud-regions
How do I connect to them?
List Servers
openstack \
        --auth-url=https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0 \
        --username=mordred@inaugust.com \
        --password=XXXXXX \
        --project-name=mordred@inaugust.com \
        --region-name=region-b.geo-1 \
    server list
          
Well that's silly
Consistent Environment Variables
export OS_AUTH_URL=https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0
export OS_USERNAME=mordred@inaugust.com
export OS_PASSWORD=XXXXXXXXXXXXX
export OS_TENANT_NAME=mordred@inaugust.com
export OS_REGION_NAME=region-b.geo-1
          
12 shell script snippet files
ENV processing is in command line tools, not client libraries
ENV processing is just copied everywhere
$ egrep -r 'add_(option|argument).*os-username' openstack/python*client | wc -l
13
          

Pre-existing knowledge

  • auth-url
  • glance API version
  • override settings
    • URLs (swift URL in rackspace keystone catalog is wrong)
    • service types (DNS in HP is hpext:dns)

I wrote a library (yay!)

os-client-config

Processes, in this order

  • config file: clouds.yaml
  • env vars
  • command line args

Provides vendor defaults

CLOUD_DEFAULTS = dict(
    hp=dict(
        auth_url='https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0',
        dns_service_type='hpext:dns',
    ),
    rackspace=dict(
        auth_url='https://identity.api.rackspacecloud.com/v2.0/',
        database_service_type='rax:database',
        image_api_version='2',
    )
)
            

Patches welcome for any cloud

clouds.yaml

clouds:
  mordred:
    cloud: hp
    username: mordred@inaugust.com
    password: XXXXXXXXXX
    project_name: mordred@inaugust.com
    region_name: region-b.geo-1
  monty:
    cloud: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0
    username: monty.taylor@hp.com
    password: XXXXXXXXX
    project_name: monty.taylor@hp.com-default-tenant
    region_name: region-b.geo-1
    dns_service_type: hpext:dns
  rax:
    cloud: rackspace
    username: openstackci
    password: XXXXXXX
    project_id: 610275
    region_name: DFW,ORD,IAD
            

Allows for named clouds

openstack --cloud=mordred server list
            
export OS_CLOUD=mordred
openstack server list
            

Where is it in use?

  • Shade library
  • python-openstackclient (patch in flight)
  • ansible (patch in flight)

Where is it?

http://git.openstack.org/stackforge/os-client-config

http://pypi.python.org/pypi/os-client-config

Where is it?

http://git.openstack.org/stackforge/os-client-config

http://pypi.python.org/pypi/os-client-config