Red Hat Training

A Red Hat training course is available for RHEL 8

99.6. Ansible 플레이북을 사용하여 기존 IdM 서버를 볼 수 있는지 확인

Ansible 플레이북에서 ipaserver ansible-freeipa 모듈을 사용하여 기존 IdM(Identity Management) 서버가 표시되는지 확인합니다. 이 플레이북은 IdM 서버를 설치하지 않습니다.

사전 요구 사항

  • IdM 관리자 암호를 알고 있습니다.
  • 다음 요구 사항을 충족하도록 Ansible 제어 노드를 구성했습니다.

    • Ansible 버전 2.14 이상을 사용하고 있습니다.
    • Ansible 컨트롤러에 ansible-freeipa 패키지가 설치되어 있습니다.
    • 이 예제에서는 ~/MyPlaybook/ 디렉터리에서 IdM 서버의 FQDN(정규화된 도메인 이름)을 사용하여 Ansible 인벤토리 파일을 생성했다고 가정합니다.
    • 이 예제에서는 secret.yml Ansible 자격 증명 모음이 ipaadmin_password 를 저장하는 것으로 가정합니다.
  • ansible-freeipa 모듈이 실행되는 노드인 대상 노드는 IdM 도메인의 일부인 IdM 클라이언트, 서버 또는 복제본입니다.

    • 제어 노드에서 인벤토리 파일에 정의된 IdM 서버로의 SSH 연결이 올바르게 작동합니다.

절차

  1. ~/MyPlaybooks/ 디렉터리로 이동합니다.

    $ cd ~/MyPlaybooks/
  2. /usr/share/doc/ansible -freeipa/playbooks/server/ 디렉터리에 있는 server-not- hidden.yml Ansible 플레이북 파일을 복사합니다.

    $ cp /usr/share/doc/ansible-freeipa/playbooks/server/server-not-hidden.yml server-not-hidden-copy.yml
  3. 편집을 위해 server-not-hidden-copy.yml 파일을 엽니다.
  4. ipaserver 작업 섹션에서 다음 변수를 설정하여 파일을 수정하고 파일을 저장합니다.

    • ipaadmin_password 변수를 IdM 관리자의 암호로 설정합니다.
    • name 변수를 서버의 FQDN 으로 설정합니다. 예제 서버의 FQDNserver123.idm.example.com 입니다.
    • 숨겨진 변수가 no 로 설정되어 있는지 확인합니다.
    ---
    - name: Server not hidden example
      hosts: ipaserver
      vars_files:
      - /home/user_name/MyPlaybooks/secret.yml
      tasks:
      - name: Ensure server server123.idm.example.com is not hidden
        ipaserver:
          ipaadmin_password: "{{ ipaadmin_password }}"
          name: server123.idm.example.com
          hidden: no
  5. Ansible 플레이북을 실행하고 플레이북 파일 및 인벤토리 파일을 지정합니다.

    $ ansible-playbook --vault-password-file=password_file -v -i inventory server-not-hidden-copy.yml

추가 리소스