11.10. Configuring a high availability cluster that implements access control lists (ACLs) by using the ha_cluster RHEL system role


You can use the ha_cluster RHEL system role to configure high availability clusters with access control lists (ACLs). With ACLs, you can grant permission for specific local users other than user hacluster to manage a Pacemaker cluster.

A common use case for this feature is to restrict unauthorized users from accessing business-sensitive information.

By default, ACLs are not enabled. Consequently, any member of the group haclient on all nodes has full local read and write access to the cluster configuratioan. Users who are not members of haclient have no access. When ACLs are enabled, however, even users who are members of the haclient group have access only to what has been granted to that user by the ACLs. The root and hacluster user accounts always have full access to the cluster configuration, even when ACLs are enabled.

When you set permissions for local users with ACLs, you create a role which defines the permissions for that role. You then assign that role to a user. If you assign multiple roles to the same user, any deny permission takes precedence, then write, then read.

The following example procedure uses the ha_cluster RHEL system role to create in an automated fashion a high availability cluster that implements ACLs to control access to the cluster configuration.

警告

The ha_cluster RHEL system role replaces any existing cluster configuration on the specified nodes. Any settings not specified in the playbook will be lost.

Prerequisites

Procedure

  1. Store your sensitive variables in an encrypted file:

    1. Create the vault:

      $ ansible-vault create ~/vault.yml
      New Vault password: <vault_password>
      Confirm New Vault password: <vault_password>
    2. After the ansible-vault create command opens an editor, enter the sensitive data in the <key>: <value> format:

      cluster_password: <cluster_password>
    3. Save the changes, and close the editor. Ansible encrypts the data in the vault.
  2. Create a playbook file, for example, ~/playbook.yml, with the following content:

    ---
    - name: Create a high availability cluster
      hosts: node1 node2
      vars_files:
        - ~/vault.yml
      tasks:
        - name: Configure a cluster with ACLs assigned
          ansible.builtin.include_role:
            name: redhat.rhel_system_roles.ha_cluster
          vars:
              ha_cluster_cluster_name: my-new-cluster
              ha_cluster_hacluster_password: "{{ cluster_password }}"
              ha_cluster_manage_firewall: true
              ha_cluster_manage_selinux: true
              # To use an ACL role permission reference, the reference must exist in CIB.
              ha_cluster_resource_primitives:
                - id: not-for-operator
                  agent: 'ocf:pacemaker:Dummy'
              # ACLs must be enabled (using the enable-acl cluster property) in order to be effective.
              ha_cluster_cluster_properties:
                - attrs:
                    - name: enable-acl
                      value: 'true'
              ha_cluster_acls:
                acl_roles:
                  - id: operator
                    description: HA cluster operator
                    permissions:
                      - kind: write
                        xpath: //crm_config//nvpair[@name='maintenance-mode']
                      - kind: deny
                        reference: not-for-operator
                  - id: administrator
                    permissions:
                      - kind: write
                        xpath: /cib
                acl_users:
                  - id: alice
                    roles:
                      - operator
                      - administrator
                  - id: bob
                    roles:
                      - administrator
                acl_groups:
                  - id: admins
                    roles:
                      - administrator

    The settings specified in the example playbook include the following:

    ha_cluster_cluster_name: <cluster_name>
    The name of the cluster you are creating.
    ha_cluster_hacluster_password: <password>
    The password of the hacluster user. The hacluster user has full access to a cluster.
    ha_cluster_manage_firewall: true
    A variable that determines whether the ha_cluster RHEL system role manages the firewall.
    ha_cluster_manage_selinux: true
    A variable that determines whether the ha_cluster RHEL system role manages the ports of the firewall high availability service using the selinux RHEL system role.
    ha_cluster_resource_primitives: <cluster resources>
    A list of resource definitions for the Pacemaker resources configured by the ha_cluster RHEL system role, including fencing resources.
    ha_cluster_cluster_properties: <cluster properties>
    A list of sets of cluster properties for Pacemaker cluster-wide configuration.
    ha_cluster_acls: <dictionary>
    A dictionary of ACL role, user, and group values.

    For details about all variables used in the playbook, see the /usr/share/ansible/roles/rhel-system-roles.ha_cluster/README.md file on the control node.

  3. Validate the playbook syntax:

    $ ansible-playbook --syntax-check --ask-vault-pass ~/playbook.yml

    Note that this command only validates the syntax and does not protect against a wrong but valid configuration.

  4. Run the playbook:

    $ ansible-playbook --ask-vault-pass ~/playbook.yml
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部