31.3. Ansible을 사용하여 IdM에 A 및 AAAA DNS 레코드가 있는지 확인

Ansible 플레이북을 사용하여 특정 IdM 호스트의 A 및 AAAA 레코드가 있는지 확인하려면 다음 절차를 따르십시오. 아래 절차에 사용된 예제에서 IdM 관리자는 idm.example.com DNS 영역에 host1 의 A 및 AAAA 레코드가 있는지 확인합니다.

사전 요구 사항

  • 다음 요구 사항을 충족하도록 Ansible 제어 노드를 구성했습니다.

    • Ansible 버전 2.14 이상을 사용하고 있습니다.
    • Ansible 컨트롤러에 ansible-freeipa 패키지가 설치되어 있습니다.
    • 이 예제에서는 ~/MyPlaybook/ 디렉터리에서 IdM 서버의 FQDN(정규화된 도메인 이름)을 사용하여 Ansible 인벤토리 파일을 생성했다고 가정합니다.
    • 이 예제에서는 secret.yml Ansible 자격 증명 모음이 ipaadmin_password 를 저장한다고 가정합니다.
  • IdM 관리자 암호를 알고 있습니다.
  • idm.example.com 영역이 존재하며 IdM DNS에서 관리합니다. IdM DNS에서 기본 DNS 영역을 추가하는 방법에 대한 자세한 내용은 Ansible 플레이북을 사용하여 IdM DNS 영역 관리를 참조하십시오.

절차

  1. /usr/share/doc/ansible-freeipa/playbooks/dnsrecord 디렉터리로 이동합니다.

    $ cd /usr/share/doc/ansible-freeipa/playbooks/dnsrecord
  2. 인벤토리 파일을 열고 구성하려는 IdM 서버가 [ipaserver] 섹션에 나열되어 있는지 확인합니다. 예를 들어, server.idm.example.com 을 구성하도록 Ansible에 지시하려면 다음을 입력합니다.

    [ipaserver]
    server.idm.example.com
  3. ensure-A-and-AAAA-records-are-present.yml Ansible 플레이북 파일을 복사합니다. 예를 들어 다음과 같습니다.

    $ cp ensure-A-and-AAAA-records-are-present.yml ensure-A-and-AAAA-records-are-present-copy.yml
  4. 편집을 위해 ensure-A-and-AAAA- records-are-present-copy.yml 파일을 엽니다.
  5. ipadnsrecord 작업 섹션에서 다음 변수를 설정하여 파일을 조정합니다.

    • ipaadmin_password 변수를 IdM 관리자 암호로 설정합니다.
    • zone_name 변수를 idm.example.com 으로 설정합니다.
    • records 변수에서 name 변수를 host1 로 설정하고 a_ip_address 변수를 192.168.122.123 로 설정합니다.
    • records 변수에서 name 변수를 host1 로 설정하고 aaaa_ip_address 변수를 ::1 로 설정합니다.

      현재 예제에 대해 수정된 Ansible 플레이북 파일입니다.

    ---
    - name: Ensure A and AAAA records are present
      hosts: ipaserver
      become: true
      gather_facts: false
    
      tasks:
      # Ensure A and AAAA records are present
      - name: Ensure that 'host1' has A and AAAA records.
        ipadnsrecord:
          ipaadmin_password: "{{ ipaadmin_password }}"
          zone_name: idm.example.com
          records:
          - name: host1
            a_ip_address: 192.168.122.123
          - name: host1
            aaaa_ip_address: ::1
  6. 파일을 저장합니다.
  7. 플레이북을 실행합니다.

    $ ansible-playbook --vault-password-file=password_file -v -i inventory.file ensure-A-and-AAAA-records-are-present-copy.yml

추가 리소스

  • IdM의 DNS 레코드를 참조하십시오.
  • /usr/share/doc/ansible -freeipa/ 디렉토리의 README-dns history.md 파일을 참조하십시오.
  • /usr/share/doc/ansible-freeipa/playbooks/dnsrecord 디렉터리의 샘플 Ansible 플레이북을 참조하십시오.