Red Hat Training

A Red Hat training course is available for RHEL 8

第83章 Ansible を使用して IdM にサービスを配置させる手順およびさせない手順

Ansible サービス モジュールを使用すると、Identity Management (IdM) 管理者は、IdM ネイティブではない特定のサービスが IdM に存在するか、存在しないかを確認できます。たとえば、サービス モジュールを使用すると以下を行うことができます。

83.1. Ansible Playbook を使用して IdM に HTTP サービスを存在させる手順

以下の手順に従って、Ansible Playbook を使用して IdM に HTTP サーバーが存在することを確認します。

前提条件

  • HTTP サービスをホストするシステムが IdM クライアントである。
  • 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-present.yml) のコピーを作成します。以下に例を示します。

    $ cp /usr/share/doc/ansible-freeipa/playbooks/service/service-is-present.yml /usr/share/doc/ansible-freeipa/playbooks/service/service-is-present-copy.yml
  4. Ansible Playbook ファイル (/usr/share/doc/ansible-freeipa/playbooks/service/service-is-present-copy.yml) を開きます。

    ---
    - name: Playbook to manage IPA service.
      hosts: ipaserver
      gather_facts: false
    
      vars_files:
      - /home/user_name/MyPlaybooks/secret.yml
      tasks:
      # Ensure service is present
      - ipaservice:
          ipaadmin_password: "{{ ipaadmin_password }}"
          name: HTTP/client.idm.example.com
  5. ファイルを調整します。

    • ipaadmin_password 変数で定義されている IdM 管理者パスワードを変更します。
    • ipaservice タスクの name 変数で定義されているように、HTTP サービスが実行されている IdM クライアントの名前を変更します。
  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-present-copy.yml

検証手順

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

Services リストに HTTP/client.idm.example.com@IDM.EXAMPLE.COM がある場合は、Ansible Playbook は IdM に正常に追加されています。

関連情報