How do you install dnf on Amazon Linux 2?

1

I am trying to run Ansible using python 3 on Amazon Linux 2 but dnf is required to install OS packages.

$ ansible-playbook -v playbook.yml  
No config file found; using defaults  
 \[WARNING]: No inventory was parsed, only implicit localhost is available  
  
 \[WARNING]: provided hosts list is empty, only localhost is available. Note that the  
implicit localhost does not match 'all'  
  
  
PLAY \[localhost] ***********************************************************************  
  
TASK \[Gathering Facts] *****************************************************************  
ok: \[localhost]  
  
TASK \[Install prerequisites packages] **************************************************  
fatal: \[localhost]: FAILED! => {"changed": false, "msg": "The Python 2 bindings for rpm are needed for this module. If you require Python 3 support use the `dnf` Ansible module instead.. The Python 2 yum module is needed for this module. If you require Python 3 support use the `dnf` Ansible module instead."}  
  
PLAY RECAP *****************************************************************************  
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  

How does one install dnf in Amazon Linux 2? Is there another workaround beside using python 2?

질문됨 5년 전8173회 조회
1개 답변
-1

Right now Amazon Linux 2 does not support dnf. If you require support for rpm and yum in ansible, you will need to run ansible with python 2.7.

-Heath

AWS
답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인