33.3. Ansible を使用した IdM での自動マウントの場所、マップ、およびキーの設定


Identity Management (IdM) のシステム管理者は、IdM で自動マウントの場所とマップを設定できます。これにより、指定した場所の IdM ユーザーが、ホストの特定のマウントポイントに移動して、NFS サーバーがエクスポートした共有にアクセスできるようになります。エクスポートされた NFS サーバーディレクトリーとマウントポイントの両方が、マップで指定されます。LDAP 用語では、ロケーションはそのようなマップエントリーのコンテナーです。

この例では、Ansible を使用して、raleigh の場所と、IdM クライアント上の /devel/project マウントポイントに nfs-server.idm.example.com:/exports/project 共有を読み取り/書き込みディレクトリーとしてマウントするマップを設定する方法を説明します。

前提条件

  • コントロールノード:

    • Ansible バージョン 2.15 以降を使用している。
    • freeipa.ansible_freeipa コレクションがインストールされている。
    • ~/MyPlaybooks/ ディレクトリーに、IdM サーバーの完全修飾ドメイン名 (FQDN) を使用して Ansible インベントリーファイル が作成されている (この例の場合)。
    • secret.yml Ansible vault に ipaadmin_password が保存されており、secret.yml ファイルを保護するパスワードを格納しているファイルにアクセスできる (この例の場合)。
  • ターゲットノード (freeipa.ansible_freeipa モジュールが実行されるノード) が、IdM クライアント、サーバー、またはレプリカとして IdM ドメインに含まれている。

手順

  1. Ansible コントロールノードで、~/MyPlaybooks/ ディレクトリーに移動します。

    $ cd ~/MyPlaybooks/
  2. /usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/playbooks/automount/ ディレクトリーにある automount-location-present.yml Ansible Playbook ファイルをコピーします。

    $ cp /usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/playbooks/automount/automount-location-present.yml automount-location-map-and-key-present.yml
  3. automount-location-map-and-key-present.yml ファイルを編集用に開きます。
  4. freeipa.ansible_freeipa.ipaautomountlocation タスクセクションで次の変数を設定して、ファイルを変更します。

    • ipaadmin_password 変数の値が secret.yml Ansible vault ファイルで定義されていることを示します。
    • name 変数を raleigh に設定します。
    • state 変数は present に設定されていることを確認します。

      以下は、今回の例で使用するように変更した Ansible Playbook ファイルです。

    ---
    - name: Automount location present example
      hosts: ipaserver
      vars_files:
      - /home/user_name/MyPlaybooks/secret.yml
      tasks:
      - name: Ensure automount location is present
        freeipa.ansible_freeipa.ipaautomountlocation:
          ipaadmin_password: "{{ ipaadmin_password }}"
          name: raleigh
          state: present
  5. automount-location-map-and-key-present.yml ファイルの編集を続けます。

    1. tasks セクションで、自動マウントマップが存在することを確認するタスクを追加します。

      [...]
        vars_files:
        - /home/user_name/MyPlaybooks/secret.yml
        tasks:
      [...]
        - name: ensure map named auto.devel in location raleigh is created
          freeipa.ansible_freeipa.ipaautomountmap:
            ipaadmin_password: "{{ ipaadmin_password }}"
            name: auto.devel
            location: raleigh
            state: present
    2. 別のタスクを追加して、マウントポイントと NFS サーバー情報をマップに追加します。

      [...]
        vars_files:
        - /home/user_name/MyPlaybooks/secret.yml
        tasks:
      [...]
        - name: ensure automount key /devel/project is present
          freeipa.ansible_freeipa.ipaautomountkey:
            ipaadmin_password: "{{ ipaadmin_password }}"
            location: raleigh
            mapname: auto.devel
            key: /devel/project
            info: nfs-server.idm.example.com:/exports/project
            state: present
    3. auto.develauto.master に接続されていることを確認する別のタスクを追加します。

      [...]
        vars_files:
        - /home/user_name/MyPlaybooks/secret.yml
        tasks:
      [...]
      - name: Ensure auto.devel is connected in auto.master:
        freeipa.ansible_freeipa.ipaautomountkey:
          ipaadmin_password: "{{ ipaadmin_password }}"
          location: raleigh
          mapname: auto.map
          key: /devel
          info: auto.devel
          state: present
  6. ファイルを保存します。
  7. Ansible Playbook を実行し、Playbook とインベントリーファイルを指定します。

    $ ansible-playbook --vault-password-file=password_file -v -i inventory automount-location-map-and-key-present.yml
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2026 Red Hat
トップに戻る