31.4. Ansible を使用して IdM ユーザーグループの automember ルールを存在させない
Ansible を使用して、Identity Management (IdM) ユーザーグループの automember ルールを削除し、ユーザー属性に基づく自動グループ割り当てを無効にします。
以下の例では、testing_group ユーザーグループに対して automember ルールが存在しないことを確認します。
automember ルールを削除すると、そのルールに関連付けられた条件もすべて削除されます。ルールから特定の条件のみを削除するには、Ansible を使用して IdM ユーザーグループの automember ルールに条件を存在させない を参照してください。
前提条件
コントロールノード:
- Ansible バージョン 2.15 以降を使用している。
-
ansible-freeipaパッケージがインストールされている。 - ~/MyPlaybooks/ ディレクトリーに、IdM サーバーの完全修飾ドメイン名 (FQDN) を使用して Ansible インベントリーファイル が作成されている (この例の場合)。
-
secret.yml Ansible vault に
ipaadmin_passwordが保存されており、secret.yml ファイルを保護するパスワードを格納しているファイルにアクセスできる (この例の場合)。
-
ターゲットノード (
freeipa.ansible_freeipaモジュールが実行されるノード) が、IdM クライアント、サーバー、またはレプリカとして IdM ドメインに含まれている。
手順
~/MyPlaybooks/ ディレクトリーに移動します。
$ cd ~/MyPlaybooks//usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/playbooks/automember/ディレクトリーにあるautomember-group-absent.ymlAnsible Playbook ファイルをコピーします。$ cp /usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/playbooks/automember/automember-group-absent.yml automember-group-absent-copy.yml-
automember-group-absent-copy.ymlを編集のために開きます。 freeipa.ansible_freeipa.ipaautomemberタスクセクションで次の変数を設定して、ファイルを変更します。-
ipaadmin_password変数は IdMadminのパスワードに設定します。 -
name変数を testing_group に設定します。 -
automember_type変数を group に設定します。 state変数は、absentに設定されていることを確認します。以下は、今回の例で使用するように変更した Ansible Playbook ファイルです。
--- - name: Automember group absent example hosts: ipaserver vars_files: - /home/user_name/MyPlaybooks/secret.yml tasks: - name: Ensure group automember rule admins is absent freeipa.ansible_freeipa.ipaautomember: ipaadmin_password: "{{ ipaadmin_password }}" name: testing_group automember_type: group state: absent
-
ファイルを保存します。
FreeIPA Ansible コレクション内の変数とサンプル Playbook の詳細は、コントロールノードの
/usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/README-automember.mdファイルと/usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/playbooks/automemberディレクトリーを参照してください。Ansible Playbook を実行します。Playbook ファイル、secret.yml ファイルを保護するパスワードを格納するファイル、およびインベントリーファイルを指定します。
$ ansible-playbook --vault-password-file=password_file -v -i inventory automember-group-absent.yml