11.6. Ansible を使用して委譲ルールに特定の属性を含めないようにする手順
以下の手順では、Ansible Playbook を使用して、委譲ルールに特定の設定が割り当てられないようにする方法を説明します。この Playbook を使用して、委譲ロールが不必要なアクセス権限を付与しないようします。この例では、basic manager attributes 委譲ルールに employeenumber
および employeetype
メンバー属性が含まれないようにします。
前提条件
コントロールノードでは、
- Ansible バージョン 2.14 以降を使用している。
-
ansible-freeipa
パッケージがインストールされている。 - ~/MyPlaybooks/ ディレクトリーに、IdM サーバーの完全修飾ドメイン名 (FQDN) を使用して Ansible インベントリーファイル を作成している (この例の場合)。
-
この例では、secret.yml Ansible Vault に
ipaadmin_password
が保存されていることを前提としています。
-
ターゲットノード (
ansible-freeipa
モジュールが実行されるノード) が、IdM クライアント、サーバー、またはレプリカとして IdM ドメインに含まれている。 - basic manager attributes 委譲ルールが IdM に存在する。
手順
~/MyPlaybooks/ ディレクトリーに移動します。
cd ~/MyPlaybooks/
$ cd ~/MyPlaybooks/
Copy to Clipboard Copied! /usr/share/doc/ansible-freeipa/playbooks/delegation/
にあるdelegation-member-absent.yml
ファイルのコピーを作成します。cp /usr/share/doc/ansible-freeipa/playbooks/delegation/delegation-member-absent.yml delegation-member-absent-copy.yml
$ cp /usr/share/doc/ansible-freeipa/playbooks/delegation/delegation-member-absent.yml delegation-member-absent-copy.yml
Copy to Clipboard Copied! -
Ansible Playbook ファイル
delegation-member-absent-copy.yml
を開きます。 ipadelegation
タスクセクションに以下の変数を設定して、ファイルを調整します。-
ipaadmin_password
変数は IdM 管理者のパスワードに設定します。 -
name
変数は、変更する委譲ルールの名前に設定します。 -
attribute
変数はemployeenumber
およびemployeetype
に設定します。 -
action
変数はmember
に設定します。 -
state
変数はabsent
に設定します。
以下は、今回の例で使用するように変更した Ansible Playbook ファイルです。
--- - name: Delegation member absent hosts: ipaserver vars_files: - /home/user_name/MyPlaybooks/secret.yml tasks: - name: Ensure delegation "basic manager attributes" member attributes employeenumber and employeetype are absent ipadelegation: ipaadmin_password: "{{ ipaadmin_password }}" name: "basic manager attributes" attribute: - employeenumber - employeetype action: member state: absent
--- - name: Delegation member absent hosts: ipaserver vars_files: - /home/user_name/MyPlaybooks/secret.yml tasks: - name: Ensure delegation "basic manager attributes" member attributes employeenumber and employeetype are absent ipadelegation: ipaadmin_password: "{{ ipaadmin_password }}" name: "basic manager attributes" attribute: - employeenumber - employeetype action: member state: absent
Copy to Clipboard Copied! -
- ファイルを保存します。
Ansible Playbook を実行します。Playbook ファイル、secret.yml ファイルを保護するパスワードを格納するファイル、およびインベントリーファイルを指定します。
ansible-playbook --vault-password-file=password_file -v -i ~/MyPlaybooks/inventory delegation-member-absent-copy.yml
$ ansible-playbook --vault-password-file=password_file -v -i ~/MyPlaybooks/inventory delegation-member-absent-copy.yml
Copy to Clipboard Copied!