Red Hat Training

A Red Hat training course is available for RHEL 8

93.12. Ansible を使用して IdM で DNS 正引きゾーンを複数配置する手順

以下の手順に従って、Ansible Playbook を使用して、IdM の DNS 正引きゾーンに複数のフォワーダーがあることを確認します。以下の手順の例では、IdM 管理者が example.com の DNS 正引きゾーンが 8.8.8.84.4.4.4 に転送されるようにします。

前提条件

  • 次の要件を満たすように Ansible コントロールノードを設定している。

    • Ansible バージョン 2.14 以降を使用している。
    • Ansible コントローラーに ansible-freeipa パッケージがインストールされている。
    • この例では、~/MyPlaybooks/ ディレクトリーに、IdM サーバーの完全修飾ドメイン名 (FQDN) を使用して Ansible インベントリーファイル を作成したことを前提としている。
    • この例では、secret.yml Ansible ボールトに ipaadmin_password が保存されていることを前提としている。
  • IdM 管理者パスワードを把握している。

手順

  1. /usr/share/doc/ansible-freeipa/playbooks/dnsconfig ディレクトリーに移動します。

    $ cd /usr/share/doc/ansible-freeipa/playbooks/dnsconfig
  2. インベントリーファイルを開き、設定する IdM サーバーが [ipaserver] セクションに記載されていることを確認します。たとえば、Ansible に対して server.idm.example.com を設定するように指示するには、次のコマンドを実行します。

    [ipaserver]
    server.idm.example.com
  3. Ansible Playbook ファイル (forwarders-absent.yml) のコピーを作成します。以下に例を示します。

    $ cp forwarders-absent.yml ensure-presence-multiple-forwarders.yml
  4. ensure-presence-multiple-forwarders.yml ファイルを開いて編集します。
  5. 以下の変数を設定してファイルを調整します。

    1. Playbook の name 変数は、IdM DNS の DNS 正引きゾーンに複数のフォワーダーを配置する Playbook の設定に変更します。
    2. tasks セクションで、タスクの nameEnsure presence of 8.8.8.8 and 4.4.4.4 forwarders in dnsforwardzone for example.com に変更します。
    3. tasks セクションで、ipadnsconfig のヘディングを ipadnsforwardzone に変更します。
    4. ipadnsforwardzone セクションで以下を実行します。

      1. ipaadmin_password 変数を追加して、IdM 管理者パスワードに設定します。
      2. name 変数を追加して example.com に設定します。
      3. forwarders セクションで、以下を実行します。

        1. ip_addressport の行を削除します。
        2. 配置する DNS サーバーの IP アドレスを、前にダッシュをつけて追加します。

          - 8.8.8.8
          - 4.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
      ipadnsforwardzone:
          ipaadmin_password: "{{ ipaadmin_password }}"
         name: example.com
          forwarders:
              - 8.8.8.8
              - 4.4.4.4
          state: present
  6. ファイルを保存します。
  7. Playbook を実行します。

    $ ansible-playbook --vault-password-file=password_file -v -i inventory.file ensure-presence-multiple-forwarders.yml

関連情報

  • /usr/share/doc/ansible-freeipa/ ディレクトリーの README-dnsforwardzone.md ファイルを参照してください。