Red Hat Training

A Red Hat training course is available for RHEL 8

9.7. Ansible を使用した Ansible コントローラーに保存されているバックアップから IdM サーバーの復元

以下の手順では、Ansible Playbook を使用して、Ansible コントローラーに保存されているバックアップから IdM サーバーを復元する方法を説明します。

前提条件

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

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

手順

  1. ~/MyPlaybooks/ ディレクトリーに移動します。

    $ cd ~/MyPlaybooks/
  2. /usr/share/doc/ansible-freeipa/playbooks ディレクトリーにある restore-server-from-controller.yml ファイルのコピーを作成します。

    $ cp /usr/share/doc/ansible-freeipa/playbooks/restore-server-from-controller.yml restore-my-server-from-my-controller.yml
  3. restore-my-server-from-my-controller.yml ファイルを開いて編集します。
  4. 以下の変数を設定してファイルを調整します。

    1. hosts 変数を、インベントリーファイルのホストグループに設定します。この例では、ipaserver ホストグループに設定します。
    2. ipabackup_name 変数は、復元する ipabackup の名前に設定します。
    3. ipabackup_password 変数は LDAP Directory Manager パスワードに設定します。

      ---
      - name: Playbook to restore IPA server from controller
        hosts: ipaserver
        become: true
      
        vars:
          ipabackup_name: server.idm.example.com_ipa-full-2021-04-30-13-12-00
          ipabackup_password: <your_LDAP_DM_password>
          ipabackup_from_controller: yes
      
        roles:
        - role: ipabackup
          state: restored
  5. ファイルを保存します。
  6. Playbook ファイルとインベントリーファイルを指定して Ansible Playbook を実行します。

    $ ansible-playbook --vault-password-file=password_file -v -i ~/MyPlaybooks/inventory restore-my-server-from-my-controller.yml

関連情報

  • /usr/share/doc/ansible-freeipa/roles/ipabackup ディレクトリーの README.md ファイル
  • /usr/share/doc/ansible-freeipa/playbooks/ ディレクトリー