CentOS 8へのAnsibleインストールが失敗する

CentOS 8へのAnsibleインストールが失敗する

Ansible を正常にインストールできません。デフォルトのコマンドは次のとおりです。

yum install ansible

ただし、出力は次のようになります。

[root@localhost ~]# yum install ansible Last metadata expiration check: 0:36:48 ago on Sun 13 Oct 2019 13:27:03 CEST. Error:   Problem: conflicting requests
  - nothing provides PyYAML needed by ansible-2.8.5-1.el7.noarch
  - nothing provides python-setuptools needed by ansible-2.8.5-1.el7.noarch
  - nothing provides python-six needed by ansible-2.8.5-1.el7.noarch
  - nothing provides python-jinja2 needed by ansible-2.8.5-1.el7.noarch
  - nothing provides python2-cryptography needed by ansible-2.8.5-1.el7.noarch 
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

次のコマンドを試しました。

yum install -y epel-release yum install -y

https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

yum -y python2のインストール

Yumはpython3-pipをインストールします。

pip3 インストール可能

出力はansible --version次のとおりです

[root@localhost ~]# ansible --version ansible 2.8.5
構成ファイル = なし
構成モジュール検索パス = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
Ansible Python モジュールの場所 = /usr/local/lib/python3.6/site-packages/ansible
実行可能場所 = /usr/local/bin/ansible
Python バージョン = 3.6.8 (既定値、2019 年 10 月 7 日、17 :58:22)[GCC 8.2.1 20180905(Red Hat 8.2.1-3)]

どんな助けでも大変感謝します。

ベストアンサー1

ある意見では、ユーザーとして/ユーザーの下でpip実行しないことが明確に示されています。なぜならPythonパッケージを 。sudorootpip

~からCentOS / RHEL 8にAnsibleをインストールする方法、CentOS 8(RHEL 8にサブスクリプションベースのリポジトリがない)の場合は、セキュアインストールvirtualenvに次のコマンドを使用できます。

sudo yum install python3 python3-virtualenv python3-pip

cd ~
mkdir ansible
virtualenv-3 ansible
. ansible/bin/activate
pip3 install ansible

その後、直接呼び出すか、環境変数に~/ansible/bin/ansible-playbook追加します。~/ansible/binPATHansible

おすすめ記事