Fedora 22
Sponsored Link

OpenStack Juno : Keystone 設定#2
2015/06/05
 
Keystone に ユーザやロール、OpenStack 各コンポーネントが利用するサービスを登録しておきます。
[1] 環境変数を事前に読み込んでおきます。
「SERVICE_TOKEN」は keystone.conf で「admin_token」に設定した値
「SERVICE_ENDPOINT」は Keystoneサーバーのホスト名またはIPアドレス
[root@dlp ~]#
export SERVICE_TOKEN=admintoken

[root@dlp ~]#
export SERVICE_ENDPOINT=http://10.0.0.30:35357/v2.0/

[2] テナント(グループ)を作成します。
# admin テナント作成

[root@dlp ~]#
keystone tenant-create --name admin --description "Admin Tenant" --enabled true

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |           Admin Tenant           |
|   enabled   |               True               |
|      id     | a521391a3fff4634ab11a18d06772ded |
|     name    |              admin               |
+-------------+----------------------------------+

# service テナント作成

[root@dlp ~]#
keystone tenant-create --name service --description "Service Tenant" --enabled true

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |          Service Tenant          |
|   enabled   |               True               |
|      id     | 164aae3d5dd34992b62855fca07d8833 |
|     name    |             service              |
+-------------+----------------------------------+

# 設定確認

[root@dlp ~]#
keystone tenant-list

+----------------------------------+---------+---------+
|                id                |   name  | enabled |
+----------------------------------+---------+---------+
| a521391a3fff4634ab11a18d06772ded |  admin  |   True  |
| 164aae3d5dd34992b62855fca07d8833 | service |   True  |
+----------------------------------+---------+---------+
[3] ロールを作成します。
# admin ロール作成

[root@dlp ~]#
keystone role-create --name admin

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|    id    | 93e1f582793d48a8b996012a09557c6c |
|   name   |              admin               |
+----------+----------------------------------+

# Member ロール作成

[root@dlp ~]#
keystone role-create --name Member

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|    id    | eaf26a3c0fdc465f82efce9bb56da6a1 |
|   name   |              Member              |
+----------+----------------------------------+

# 設定確認

[root@dlp ~]#
keystone role-list

+----------------------------------+--------+
|                id                |  name  |
+----------------------------------+--------+
| eaf26a3c0fdc465f82efce9bb56da6a1 | Member |
| 93e1f582793d48a8b996012a09557c6c | admin  |
+----------------------------------+--------+
[4] ユーザーを作成します。
# admin ユーザー作成 (admin テナント所属)

[root@dlp ~]#
keystone user-create --tenant admin --name admin --pass adminpassword --enabled true

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | 02144a8abeb54624b70b3d03be576ea7 |
|   name   |              admin               |
| tenantId | a521391a3fff4634ab11a18d06772ded |
| username |              admin               |
+----------+----------------------------------+

# admin ユーザーを adminロール に加える

[root@dlp ~]#
keystone user-role-add --user admin --tenant admin --role admin
# glance ユーザー作成 (service テナント所属)

[root@dlp ~]#
keystone user-create --tenant service --name glance --pass servicepassword --enabled true

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | 255a9b2f213642c49c914873324c5185 |
|   name   |              glance              |
| tenantId | 164aae3d5dd34992b62855fca07d8833 |
| username |              glance              |
+----------+----------------------------------+

# glance ユーザーを adminロール に加える

[root@dlp ~]#
keystone user-role-add --user glance --tenant service --role admin
# nova ユーザー作成 (service テナント)

[root@dlp ~]#
keystone user-create --tenant service --name nova --pass servicepassword --enabled true

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | 3cae2a58c0144424a697a04b4ee01fd2 |
|   name   |               nova               |
| tenantId | 164aae3d5dd34992b62855fca07d8833 |
| username |               nova               |
+----------+----------------------------------+

# nova ユーザーを adminロール に加える

[root@dlp ~]#
keystone user-role-add --user nova --tenant service --role admin
# 設定確認

[root@dlp ~]#
keystone user-list

+----------------------------------+--------+---------+-------+
|                id                |  name  | enabled | email |
+----------------------------------+--------+---------+-------+
| 02144a8abeb54624b70b3d03be576ea7 | admin  |   True  |       |
| 255a9b2f213642c49c914873324c5185 | glance |   True  |       |
| 3cae2a58c0144424a697a04b4ee01fd2 |  nova  |   True  |       |
+----------------------------------+--------+---------+-------+
[5] サービス用のエントリを作成します。
# keystone用サービスエントリ作成

[root@dlp ~]#
keystone service-create --name=keystone --type=identity --description="Keystone Identity Service"

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |    Keystone Identity Service     |
|   enabled   |               True               |
|      id     | 5f8aefb97c144631997feb33fece661d |
|     name    |             keystone             |
|     type    |             identity             |
+-------------+----------------------------------+

# glance用サービスエントリ作成

[root@dlp ~]#
keystone service-create --name=glance --type=image --description="Glance Image Service"

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |       Glance Image Service       |
|   enabled   |               True               |
|      id     | 88fdac02a8d547ce9efb0405730558b3 |
|     name    |              glance              |
|     type    |              image               |
+-------------+----------------------------------+

# nova用サービスエントリ作成

[root@dlp ~]#
keystone service-create --name=nova --type=compute --description="Nova Compute Service"

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |       Nova Compute Service       |
|   enabled   |               True               |
|      id     | 6861754fadee4dc8831e5895bba684c6 |
|     name    |               nova               |
|     type    |             compute              |
+-------------+----------------------------------+

# 設定確認

[root@dlp ~]#
keystone service-list

+----------------------------------+----------+----------+---------------------------+
|                id                |   name   |   type   |        description        |
+----------------------------------+----------+----------+---------------------------+
| 88fdac02a8d547ce9efb0405730558b3 |  glance  |  image   |    Glance Image Service   |
| 5f8aefb97c144631997feb33fece661d | keystone | identity | Keystone Identity Service |
| 6861754fadee4dc8831e5895bba684c6 |   nova   | compute  |    Nova Compute Service   |
+----------------------------------+----------+----------+---------------------------+
[6] エンドポイントを作成します。
# 自ホストを定義しておく

[root@dlp ~]#
export my_host=10.0.0.30
# keystone 用エンドポイント作成

[root@dlp ~]#
keystone endpoint-create --region RegionOne \
--service keystone \
--publicurl "http://$my_host:\$(public_port)s/v2.0" \
--internalurl "http://$my_host:\$(public_port)s/v2.0" \
--adminurl "http://$my_host:\$(admin_port)s/v2.0"

+-------------+---------------------------------------+
|   Property  |                 Value                 |
+-------------+---------------------------------------+
|   adminurl  |  http://10.0.0.30:$(admin_port)s/v2.0 |
|      id     |    8ecee34531f643cd91cd2b44552d9945   |
| internalurl | http://10.0.0.30:$(public_port)s/v2.0 |
|  publicurl  | http://10.0.0.30:$(public_port)s/v2.0 |
|    region   |               RegionOne               |
|  service_id |    5f8aefb97c144631997feb33fece661d   |
+-------------+---------------------------------------+

# glance 用エンドポイント作成

[root@dlp ~]#
keystone endpoint-create --region RegionOne \
--service glance \
--publicurl "http://$my_host:9292/v1" \
--internalurl "http://$my_host:9292/v1" \
--adminurl "http://$my_host:9292/v1"

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
|   adminurl  |     http://10.0.0.30:9292/v1     |
|      id     | fe7342140cf04950b6a9601781fae129 |
| internalurl |     http://10.0.0.30:9292/v1     |
|  publicurl  |     http://10.0.0.30:9292/v1     |
|    region   |            RegionOne             |
|  service_id | 88fdac02a8d547ce9efb0405730558b3 |
+-------------+----------------------------------+

# nova 用エンドポイント作成

[root@dlp ~]#
keystone endpoint-create --region RegionOne \
--service nova \
--publicurl "http://$my_host:\$(compute_port)s/v2/\$(tenant_id)s" \
--internalurl "http://$my_host:\$(compute_port)s/v2/\$(tenant_id)s" \
--adminurl "http://$my_host:\$(compute_port)s/v2/\$(tenant_id)s"

+-------------+----------------------------------------------------+
|   Property  |                       Value                        |
+-------------+----------------------------------------------------+
|   adminurl  | http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s |
|      id     |          6001769bb0b04a998e6bf8d6950f6588          |
| internalurl | http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s |
|  publicurl  | http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s |
|    region   |                     RegionOne                      |
|  service_id |          6861754fadee4dc8831e5895bba684c6          |
+-------------+----------------------------------------------------+

# 設定確認

[root@dlp ~]#
keystone endpoint-list

+----------------------------------+-----------+----------------------------------------------------+
|                id                |   region  |                     publicurl                      |
+----------------------------------+-----------+----------------------------------------------------+
| 6001769bb0b04a998e6bf8d6950f6588 | RegionOne | http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s |
| 8ecee34531f643cd91cd2b44552d9945 | RegionOne |       http://10.0.0.30:$(public_port)s/v2.0        |
| fe7342140cf04950b6a9601781fae129 | RegionOne |              http://10.0.0.30:9292/v1              |
+----------------------------------+-----------+----------------------------------------------------+
+----------------------------------------------------+
|                    internalurl                     |
+----------------------------------------------------+
| http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s |
|       http://10.0.0.30:$(public_port)s/v2.0        |
|              http://10.0.0.30:9292/v1              |
+----------------------------------------------------+
+----------------------------------------------------+----------------------------------+
|                      adminurl                      |            service_id            |
+----------------------------------------------------+----------------------------------+
| http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s | 6861754fadee4dc8831e5895bba684c6 |
|        http://10.0.0.30:$(admin_port)s/v2.0        | 5f8aefb97c144631997feb33fece661d |
|              http://10.0.0.30:9292/v1              | 88fdac02a8d547ce9efb0405730558b3 |
+----------------------------------------------------+----------------------------------+
 
Tweet