Red Hat Training

A Red Hat training course is available for RHEL 8

44.5. Ansible Playbook を使用して IdM ホストエントリーがないことを確認する手順

以下の手順に従って、Ansible Playbook を使用して Identity Management (IdM) にホストエントリーがないことを確認します。

前提条件

  • IdM 管理者の認証情報

手順

  1. inventory.file などのインベントリーファイルを作成して、そのファイルに ipaserver を定義します。

    [ipaserver]
    server.idm.example.com
  2. IdM に存在させないホストの 完全修飾ドメイン名 (FQDN) を指定して Ansible Playbook ファイルを作成します。IdM ドメインに DNS が統合されている場合は、updatedns: yes オプションを使用して、あらゆる種類のホストに関連するレコードを DNS から削除します。

    この手順は、/usr/share/doc/ansible-freeipa/playbooks/host/delete-host.yml ファイルのサンプルをコピーして変更し、簡素化できます。

    ---
    - name: Host absent
      hosts: ipaserver
    
      vars_files:
      - /home/user_name/MyPlaybooks/secret.yml
      tasks:
      - name: Host host01.idm.example.com absent
        ipahost:
          ipaadmin_password: "{{ ipaadmin_password }}"
          name: host01.idm.example.com
          updatedns: yes
          state: absent
  3. Playbook を実行します。

    $ ansible-playbook --vault-password-file=password_file -v -i path_to_inventory_directory/inventory.file path_to_playbooks_directory/ensure-host-absent.yml
注記

この手順の結果は以下のようになります。

  • IdM Kerberos レルムにホストが存在していない。
  • IdM LDAP サーバーにホストエントリーが存在しない。

SSSD (System Security Services Daemon) などのシステムサービスの特定の IdM 設定をクライアントホスト自体から削除するには、クライアントで ipa-client-install --uninstall コマンドを実行する必要があります。詳細は、IdM クライアントのアンインストール を参照してください。

検証手順

  1. admin として ipaserver にログインします。

    $ ssh admin@server.idm.example.com
    Password:
    [admin@server /]$
  2. host01.idm.example.com に関する情報を表示します。

    $ ipa host-show host01.idm.example.com
    ipa: ERROR: host01.idm.example.com: host not found

この出力では、ホストが IdM に存在しないことを確認します。