官术网_书友最值得收藏!

Creating tenants in Keystone

A tenant in OpenStack is a project, and the two terms are generally used interchangeably. Users can't be created without having a tenant assigned to them, so these must be created first. For this section, we will create a tenant called cookbook for our users.

Getting ready

We will be using the keystone client to operate Keystone. If the python-keystoneclient tool isn't available, follow the steps described at http://bit.ly/OpenStackCookbookClientInstall.

Ensure that we have our environment set correctly to access our OpenStack environment for administrative purposes:

export OS_TENANT_NAME=cookbook
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=https://192.168.100.200:5000/v2.0/
export OS_NO_CACHE=1
export OS_KEY=/vagrant/cakey.pem
export OS_CACERT=/vagrant/ca.pem

Tip

You can use the controller node if no other machines are available on your network, as this has the python-keystoneclient and the relevant access to the OpenStack environment. If you are using the Vagrant environment issue the following command to get access to the Controller:

vagrant ssh controller

How to do it...

To create a tenant in our OpenStack environment, perform the following steps:

  1. We start by creating a tenant called cookbook:
    keystone tenant-create \
     --name cookbook \
     --description "Default Cookbook Tenant" \
     --enabled true
    

    This will produce output similar to:

    +-------------+----------------------------------+
    | Property | Value |
    +-------------+----------------------------------+
    | description | Default Cookbook Tenant |
    | enabled | True |
    | id | fba7b31689714d1ab39a751bc9483efd |
    | name | cookbook |
    +-------------+----------------------------------+
    
  2. We also need an admin tenant so that when we create users in this tenant, they have access to our complete environment. We do this in the same way as in the previous step:
    keystone tenant-create \
     --name admin \
     --description "Admin Tenant" \
     --enabled true
    

How it works...

Creation of the tenants is achieved by using the keystone client, specifying the tenant-create option with the following syntax:

keystone tenant-create \
 --name tenant_name \
 --description "A description" \
 --enabled true

The tenant_name is an arbitrary string and must not contain spaces. On creation of the tenant, this returns an ID associated with it that we use when adding users to this tenant. To see a list of tenants and the associated IDs in our environment, we can issue the following command:

keystone tenant-list
主站蜘蛛池模板: 兰西县| 通辽市| 大石桥市| 巴彦淖尔市| 循化| 江门市| 子长县| 抚宁县| 北票市| 双江| 丹凤县| 藁城市| 白沙| 吴堡县| 西畴县| 逊克县| 灵寿县| 利津县| 鄂尔多斯市| 宜兴市| 苗栗市| 江门市| 禄劝| 临泉县| 千阳县| 汾西县| 漳州市| 武胜县| 昌吉市| 青州市| 盖州市| 徐闻县| 奉节县| 沛县| 芜湖市| 嵊州市| 夏邑县| 小金县| 九寨沟县| 称多县| 仁布县|