Ansible 제어 노드 설정

Ansible 제어 노드를 설정하려면 SUSE Multi-Linux Manager Web UI에서 다음 단계를 실행합니다.

To configure a client as the Ansible Control Node, the Ansible package must be installed on that system. Usually, the Ansible package should be obtained from the operating system vendor’s official repositories. For example, on SUSE Linux Enterprise 15 SP6 and SP7, Ansible is available through the Systems Management Module.

절차: SUSE Linux Enterprise 15 SP6 또는 SP7 시스템에 Ansible 제어 노드 설정
  1. In the SUSE Multi-Linux Manager Web UI, navigate to Admin  Setup Wizard  Products, verify that SUSE Linux Enterprise Server 15 SP6 x86_64 (or later) with the Systems Management Module and the required Python 3 Module are selected and synchronized.

  2. SUSE Linux Enterprise 15 SP6(또는 상위 버전) 클라이언트를 배포합니다.

  3. In the SUSE Multi-Linux Manager Web UI, navigate to the Systems  Overview page of the client. Select Software  Software Channels and subscribe the client to the SUSE Linux Enterprise Server 15 SP6 x86_64 (or later SP), Systems Management Module and Python 3 Module channels.

  4. Select Details  Properties of your client. From the Add-On System Types list enable Ansible Control Node and click Update Properties.

  5. 클라이언트 개요 페이지로 이동하여 상태  Highstate를 선택하고 Highstate 적용을 클릭합니다.

  6. 이벤트 탭을 선택하고 highstate의 상태를 확인합니다.

If you want to install a newer Ansible on a SUSE Linux Enterprise 15 SP4 or SP5 client, you must enable the Python 3 Module.

최신 버전의 Ansible은 더 이상 오래된 Python 버전을 통한 노드 관리를 지원하지 않습니다. 관리형 노드가 여전히 기존 Python 버전으로 기본 설정되어 있는 경우 플레이북 실행 중에 연결 오류가 발생하거나 실패할 수 있습니다. 이 문제를 해결하려면 가능한 경우 관리형 노드에서 Python을 업그레이드하고 Ansible 인벤토리 또는 구성에서 올바른 Python 인터프리터를 설정해야 합니다.

1. Ansible 인벤토리 파일 생성

Ansible Integration 도구는 플레이북을 인벤토리 파일로 배포합니다. _테이블 1_에 나열된 각 운영 체제에 대해 인벤토리 파일을 하나씩 생성합니다.

절차: Ansible 인벤토리 파일 생성
  1. Create and add your hosts to an inventory file to be managed by Ansible. The default path for an Ansible inventory is /etc/ansible/hosts.

    Listing 1. 인벤토리 예시
    client240.mgr.example.org
    client241.mgr.example.org
    client242.mgr.example.org
    client243.mgr.example.org ansible_ssh_private_key_file=/etc/ansible/some_ssh_key
    
    [mygroup1]
    client241.mgr.example.org
    client242.mgr.example.org
    
    [mygroup2]
    client243.mgr.example.org
    
    [all:vars]
    ansible_ssh_public_key_file=/etc/ansible/my_ansible_private_key
  2. In the SUSE Multi-Linux Manager Web UI, from the Ansible tab navigate to Ansible  Control Node to add inventory files to the control node.

  3. Under the Playbook Directories section add /usr/share/scap-security-guide/ansible to the Add a Playbook Directories field and click Save.

  4. Under Inventory Files add your inventory file locations to the Add an Inventory file field and click Save.

    Listing 2. 예제
    /etc/ansible/sles15
    /etc/ansible/sles12
    /etc/ansible/centos7

    더 많은 플레이북 예시는 https://github.com/ansible/ansible-examples에서 확인할 수 있습니다.

절차: Ansible 노드와 통신 설정하기
  1. 인벤토리에서 사용 중인 SSH 키를 생성합니다.

    ssh-keygen -f /etc/ansible/my_ansible_private_key
  2. 생성된 SSH 키를 Ansible 관리 클라이언트에 복사합니다. 예시는 다음과 같습니다.

    ssh-copy-id -i /etc/ansible/my_ansible_public_key root@client240.mgr.example.org
  3. Declare the private key in /etc/ansible/ansible.cfg as follows:

    private_key_file = /etc/ansible/my_ansible_private_key

    Replace my_ansible_private_key with the name of the file containing the private key.

  4. 제어 노드에서 다음 명령을 실행하여 Ansible 작동 여부를 테스트하십시오.

    ansible all -m ping
    ansible mygroup1 -m ping
    ansible client240.mgr.example.org -m ping

이제 수정을 실행할 수 있습니다. 자세한 내용은 코드형 규정 준수에서 확인할 수 있습니다.