30장. Ansible 플레이북을 사용하여 사용자를 관리하도록 사용자 그룹에 권한 위임
위임은 셀프 서비스 규칙 및 RBAC(역할 기반 액세스 제어)와 함께 IdM의 액세스 제어 방법 중 하나입니다. 위임을 사용하여 한 사용자 그룹에 다른 사용자 그룹의 항목을 관리할 수 있는 권한을 할당할 수 있습니다.
위임 규칙 일반 정보에 대한 자세한 내용은 위임 규칙 섹션을 참조하십시오.
30.1. Ansible을 사용하여 위임 규칙이 있는지 확인
다음 절차에서는 Ansible 플레이북을 사용하여 새 IdM 위임 규칙에 대한 권한을 정의하고 해당 존재 여부를 확인하는 방법을 설명합니다. 이 예제에서 새로운 기본 관리자 속성 위임 규칙은 managers
그룹에 employees
그룹 멤버에 대해 다음 속성을 읽고 쓸 수 있는 기능을 부여합니다.
-
businesscategory
-
부서 번호
-
CryostatNumber
-
employeetype
사전 요구 사항
제어 노드에서 다음을 수행합니다.
- Ansible 버전 2.15 이상을 사용하고 있습니다.
-
freeipa.ansible_freeipa
컬렉션을 설치했습니다. - 이 예제에서는 ~/MyPlaybooks/ 디렉터리에서 IdM 서버의 FQDN(정규화된 도메인 이름)을 사용하여 Ansible 인벤토리 파일을 생성했다고 가정합니다.
-
이 예제에서는 secret.yml Ansible vault가
ipaadmin_password
를 저장하고 secret.yml 파일을 보호하는 암호를 저장하는 파일에 대한 액세스 권한이 있다고 가정합니다.
-
freeipa.ansible_freeipa
모듈이 실행되는 대상 노드인 대상 노드는 IdM 도메인의 일부입니다. IdM 클라이언트, 서버 또는 복제본입니다.
프로세스
~/MyPlaybooks/ 디렉터리로 이동합니다.
cd ~/MyPlaybooks/
$ cd ~/MyPlaybooks/
Copy to Clipboard Copied! /usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/playbooks/delegation/
디렉터리에 있는delegation-present.yml
파일의 사본을 만듭니다.cp /usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/playbooks/delegation/delegation-present.yml delegation-present-copy.yml
$ cp /usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/playbooks/delegation/delegation-present.yml delegation-present-copy.yml
Copy to Clipboard Copied! -
편집을 위해
위임-present-copy.yml
Ansible 플레이북 파일을 엽니다. freeipa.ansible_freeipa.ipadelegation
작업 섹션에서 다음 변수를 설정하여 파일을 조정합니다.-
name
변수를 새 위임 규칙의 이름으로 설정합니다. -
권한
변수를 콤마로 구분된 권한 목록(읽기
및쓰기
)으로 설정합니다. -
위임된 사용자 그룹이 관리할 수 있는 속성 목록:
businesscategory
,departmentnumber
,employeenumber
,employeetype
. -
특성을 보거나 수정할 수 있는 액세스 권한이 있는 그룹의 이름으로 그룹 변수를 설정합니다.
-
membergroup
변수를 특성을 보거나 수정할 수 있는 그룹의 이름으로 설정합니다.
현재 예에 대해 수정된 Ansible 플레이북 파일입니다.
--- - name: Playbook to manage a delegation rule hosts: ipaserver vars_files: - /home/user_name/MyPlaybooks/secret.yml tasks: - name: Ensure delegation "basic manager attributes" is present freeipa.ansible_freeipa.ipadelegation: ipaadmin_password: "{{ ipaadmin_password }}" name: "basic manager attributes" permission: read, write attribute: - businesscategory - departmentnumber - employeenumber - employeetype group: managers membergroup: employees
--- - name: Playbook to manage a delegation rule hosts: ipaserver vars_files: - /home/user_name/MyPlaybooks/secret.yml tasks: - name: Ensure delegation "basic manager attributes" is present freeipa.ansible_freeipa.ipadelegation: ipaadmin_password: "{{ ipaadmin_password }}" name: "basic manager attributes" permission: read, write attribute: - businesscategory - departmentnumber - employeenumber - employeetype group: managers membergroup: employees
Copy to Clipboard Copied! -
- 파일을 저장합니다.
Ansible 플레이북을 실행합니다. 플레이북 파일을 지정하고 secret.yml 파일을 보호하는 암호를 저장하는 파일 및 인벤토리 파일을 지정합니다.
ansible-playbook --vault-password-file=password_file -v -i ~/MyPlaybooks/inventory delegation-present-copy.yml
$ ansible-playbook --vault-password-file=password_file -v -i ~/MyPlaybooks/inventory delegation-present-copy.yml
Copy to Clipboard Copied!