31.9. Ansible を使用して IdM の DNS 正引きゾーンに複数のフォワーダーが存在する状態にする
Ansible Playbook を使用して、IdM の DNS 正引きゾーンに複数のフォワーダーが存在する状態にするには、この手順を実行します。以下の手順の例では、IdM 管理者が example.com の DNS 正引きゾーンが 8.8.8.8 と 4.4.4.4 に転送されるようにします。
前提条件
次の要件を満たすように Ansible コントロールノードを設定している。
- Ansible バージョン 2.15 以降を使用している。
-
freeipa.ansible_freeipaコレクションがインストールされている。 - ~/MyPlaybooks/ ディレクトリーに、IdM サーバーの完全修飾ドメイン名 (FQDN) を使用して Ansible インベントリーファイル が作成されている (この例の場合)。
-
secret.yml Ansible vault に
ipaadmin_passwordが保存されており、secret.yml ファイルを保護するパスワードを格納しているファイルにアクセスできる (この例の場合)。
-
ターゲットノード (
freeipa.ansible_freeipaモジュールが実行されるノード) が、IdM クライアント、サーバー、またはレプリカとして IdM ドメインに含まれている。
手順
/usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/playbooks/dnsconfigディレクトリーに移動します。$ cd /usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/playbooks/dnsconfigAnsible Playbook ファイル (
forwarders-absent.yml) のコピーを作成します。以下に例を示します。$ cp forwarders-absent.yml ensure-presence-multiple-forwarders.yml-
ensure-presence-multiple-forwarders.ymlファイルを編集のために開きます。 以下の変数を設定してファイルを調整します。
-
Playbook の
name変数は、IdM DNS の DNS 正引きゾーンに複数のフォワーダーを配置する Playbookの設定に変更します。 -
tasksセクションで、タスクのnameをEnsure presence of 8.8.8.8 and 4.4.4.4 forwarders in dnsforwardzone for example.comに変更します。 -
tasksセクションで、freeipa.ansible_freeipa.ipadnsconfigという見出しをfreeipa.ansible_freeipa.ipadnsforwardzoneに変更します。 freeipa.ansible_freeipa.ipadnsforwardzoneセクションで、次の手順を実行します。-
ipaadmin_password変数の値が secret.yml Ansible vault ファイルで定義されていることを示します。 -
name変数を追加してexample.comに設定します。 forwardersセクションで、以下を実行します。-
ip_addressとportの行を削除します。 存在することを確認する DNS サーバーの IP アドレスを、先頭にダッシュを付けて追加します。
- 8.8.8.8 - 4.4.4.4
-
- state 変数を present に変更します。
今回の例で使用するように変更した Ansible Playbook ファイル:
-
--- - name: name: Playbook to ensure the presence of multiple forwarders in a dnsforwardzone in IdM DNS hosts: ipaserver vars_files: - /home/user_name/MyPlaybooks/secret.yml tasks: - name: Ensure presence of 8.8.8.8 and 4.4.4.4 forwarders in dnsforwardzone for example.com freeipa.ansible_freeipa.ipadnsforwardzone: ipaadmin_password: "{{ ipaadmin_password }}" name: example.com forwarders: - 8.8.8.8 - 4.4.4.4 state: present-
Playbook の
- ファイルを保存します。
Playbook を実行します。
$ ansible-playbook --vault-password-file=password_file -v -i inventory.file ensure-presence-multiple-forwarders.yml