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

Configuring roles in Keystone

Roles are the permissions given to users within a project. Roles can also be scoped to a particular domain, making it possible to restrict permissions for particular users to a domain and project. If you used Ansible to install your OpenStack environment, it should already contain some default roles, such as admin and _member_. Here we will configure one role, a cloud_admin role that allows for administration of our example bookstore domain environment and a user role for the default domain that is given to ordinary users who will be using the cloud environment.

Getting ready

Ensure that you are logged on to a correctly configured OpenStack client and can access the OpenStack environment as a user with admin privileges.

Refer to Chapter 2, The OpenStack Client, for details of setting up your environment to use OpenStack command-line client.

How to do it…

To create the required roles in our OpenStack environment, perform the following steps:

  1. Creation of the cloud_admin role is done as follows:
    openstack role create --domain bookstore cloud_admin:
    
    How to do it…
  2. To configure the user role for the default domain, execute the following command:
    openstack role create user
    
    How to do it…

    This command created a new role called user. Since we didn't specify a domain, it was created under the default domain.

  3. View roles associated with the bookstore domain:
    openstack role list --domain bookstore
    
    How to do it…
  4. List roles associated with the current admin user:
    openstack role list
    
    How to do it…

How it works…

Creation of roles is simply achieved using the OpenStack client, specifying the role create option with the following syntax:

openstack role create --domain <domain_name> <role_name>

The domain_name attribute is optional, if you omit it, a role for the default domain will be created.

For the role_name attribute, the admin and _member_ roles names cannot be used again. The admin role is set by default in OpenStack code starting with the Pike release, and in releases before Pike in the /etc/keystone/policy.json file, as having administrative rights:

{
    "admin_required": "role:admin or is_admin:1",
}

The _member_ role is also configured by default in the dashboard when a nonadmin user is created through the web interface.

On creation of the role, the ID associated with the role is returned, and we can use it when assigning roles to users. To see a list of roles and the associated IDs in our environment, we can issue the following command:

openstack role list --domain <domain_name>

Note

If the domain parameter is not specified, you will see roles associated only with your current user's domain.

主站蜘蛛池模板: 淮南市| 孝义市| 盘山县| 万荣县| 上饶市| 昔阳县| 富宁县| 明星| 茂名市| 丹寨县| 上犹县| 南投市| 鄂托克旗| 孟村| 华安县| 旬邑县| 呼伦贝尔市| 明水县| 揭阳市| 定边县| 阿拉善盟| 玉山县| 莆田市| 陆川县| 富平县| 万盛区| 长武县| 淳安县| 法库县| 佛教| 天水市| 博湖县| 甘泉县| 汕头市| 项城市| 奉新县| 鞍山市| 麻栗坡县| 广州市| 桂阳县| 福海县|