1.包安装
-
centos系统
#epel源的rpm包安装
[root@centos ~]#yum -y install ansible
-
ubuntu系统
root@ubuntu ~]#apt -y install ansible
-
rocky系统
#包安装存在依赖问题无法实现
[root@rocky8 ~]#yum -y install ansible
Error: Problem: conflicting requests - nothing provides python3.9dist(ansible-core) needed by ansible-6.3.0- 1.el8.noarch - nothing provides (python3.9dist(ansible-core) >= 2.13.3 with python3.9dist(ansible-core) < 2.14) needed by ansible-6.3.0-1.el8.noarch (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
2.pip安装
-
rocky系统
[root@rocky8 ~]#yum -y install python39 rust
[root@rocky8 ~]#pip3 install --upgrade pip -i https://pypi.douban.com/simple
[root@rocky8 ~]#pip3 install ansible -i https://pypi.douban.com/simple/
[root@rocky8 ~]#ansible --version
ansible [core 2.14.1] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.9/sitepackages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible python version = 3.9.6 (default, Nov 9 2021, 13:31:27) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)] (/usr/bin/python3.9) jinja version = 3.1.2 libyaml = True
-
centos系统
root@centos7 ~]#yum -y install python-pip
[root@centos7 ~]#pip install --upgrade pip
[root@centos7 ~]#pip install ansible --upgrade
[root@centos7 ~]#ansible --version
/usr/lib64/python2.7/site-packages/cryptography/__init__.py:39: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python
core team. Support for it is now deprecated in cryptography, and will be removed
in a future release.
CryptographyDeprecationWarning,
ansible 2.9.12
config file = None
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible python version = 2.7.5 (default, Apr 2 2020, 13:16:51)[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]