Ansible을 어떻게 설치하나요?

Ansible을 어떻게 설치하나요?

을 사용하여 Ansible을 설치하려고 하는데 sudo apt-get install ansible다음과 같은 결과가 나타납니다.

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ansible-core : Depends: python3-jinja2 but it is not installable
                Depends: python3-packaging but it is not installable
                Depends: python3-resolvelib but it is not installable
                Recommends: sshpass but it is not installable
E: Unable to correct problems, you have held broken packages.

Ansible을 어떻게 설치하나요?

답변1

Ansible에는 누락된 종속성을 안내하는 설치 가이드가 준비되어 있습니다.https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html

GitHub에도 개발 버전이 있습니다.https://github.com/ansible/ansible

위의 가이드에서 가져온 기본 지침은 다음과 같습니다.

  1. 다음 명령을 사용하여 Python이 설치된 위치를 찾습니다.

    which python3
    
  2. pip다음 명령을 실행하여 (Python의 일부)가 설치되었는지 확인하세요 .

    python3 -m pip -V
    

    모든 것이 정상이면 다음과 같은 내용이 표시됩니다.

    pip 21.0.1 from /usr/lib/python3.9/site-packages/pip (python 3.9)
    

    그렇다면 pip사용 가능하며 다음 단계로 넘어갈 수 있습니다.

    와 같은 오류가 표시되면 계속 진행하기 전에 선택한 Python 인터프리터를 No module named pip설치해야 합니다 . pip이는 추가 OS 패키지(예: )를 설치하거나 다음을 실행하여 Python Packaging Authority에서 직접 python3-pip최신 버전을 설치하는 것을 의미할 수 있습니다.pip

    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    python3 get-pip.py --user
    
  3. pip선택한 Python 환경에서 현재 사용자를 위해 Ansible을 설치합니다 .

    python3 -m pip install --user ansible
    

Ubuntu 릴리스 설치에 대해 언급하지 않았으므로 위의 내용이 제대로 작동하는 18.04 이상의 버전이 있을 수 있다고 가정합니다.

추가 내용은 이 답변의 시작 부분에 언급된 가이드 및 Ansible 공식 웹사이트를 참조하세요.

행운을 빌어요.

관련 정보