26.9. Ansible Playbook を使用して IdM に HTTP サービスを存在させないようにする手順

以下の手順に従って、IdM からサービスの登録を解除します。より具体的には、Ansible Playbook を使用して、IdM にある HTTP/client.idm.example.com という名前の HTTP サーバーを削除する方法を説明します。

前提条件

  • IdM 管理者パスワードがある。

手順

  1. inventory.file などのインベントリーファイルを作成します。

    $ touch inventory.file
  2. inventory.file を開き、[ipaserver] セクションに、設定する IdM サーバーを定義します。たとえば、Ansible に対して server.idm.example.com を設定するように指示するには、次のコマンドを実行します。

    [ipaserver]
    server.idm.example.com
  3. Ansible Playbook ファイル (/usr/share/doc/ansible-freeipa/playbooks/service/service-is-absent.yml) のコピーを作成します。以下に例を示します。

    $ cp /usr/share/doc/ansible-freeipa/playbooks/service/service-is-absent.yml /usr/share/doc/ansible-freeipa/playbooks/service/service-is-absent-copy.yml
  4. Ansible Playbook ファイル (/usr/share/doc/ansible-freeipa/playbooks/service/service-is-absent-copy.yml) を開きます。
  5. 以下を変更してファイルを調整します。

    • ipaadmin_password 変数で定義されている IdM 管理者パスワード。
    • ipaservice タスクの name 変数で定義されている、HTTP サービスの Kerberos プリンシパル。

      現在の例に合わせて調節すると、コピーされたファイルは以下のようになります。

    ---
    - name: Playbook to manage IPA service.
      hosts: ipaserver
      gather_facts: false
    
      vars_files:
      - /home/user_name/MyPlaybooks/secret.yml
      tasks:
      # Ensure service is absent
      - ipaservice:
          ipaadmin_password: "{{ ipaadmin_password }}"
          name: HTTP/client.idm.example.com
          state: absent
  6. ファイルを保存し、終了します。
  7. Ansible Playbook を実行します。Playbook ファイル、secret.yml ファイルを保護するパスワードを格納するファイル、およびインベントリーファイルを指定します。

    $ ansible-playbook --vault-password-file=password_file -v -i path_to_inventory_directory/inventory.file /usr/share/doc/ansible-freeipa/playbooks/service/service-is-absent-copy.yml

検証手順

  1. 管理者として IdM Web UI にログインします。
  2. IdentityServices に移動します。

Services リストに HTTP/client.idm.example.com@IDM.EXAMPLE.COM サービスが表示されていない場合には、IdM から正常に削除されています。