Linux-Ansible-安裝
阿新 • • 發佈:2022-05-16
ansible的安裝方法有多種
官方文件
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.ht
下載
https://releases.ansible.com/ansible/
pip 下載
https://pypi.org/project/ansible/
yum安裝
[root@centos7-liyj /etc/yum.repos.d]#yum install ansible Dependencies Resolved ======================================================================================================================= Package Arch Version Repository Size======================================================================================================================= Installing: ansible noarch 2.9.27-1.el7 epel 17 M Installing for dependencies: PyYAML x86_643.10-11.el7 BASE 153 k libyaml x86_64 0.1.4-11.el7_0 BASE 55 k python-babel noarch 0.9.6-8.el7 BASE 1.4 M python-backports x86_64 1.0-8.el7 BASE 5.8 k python-backports-ssl_match_hostname noarch 3.5.0.1-1.el7 BASE 13 k python-cffi x86_64 1.6.0-5.el7 BASE 218 k python-enum34 noarch 1.0.4-1.el7 BASE 52 k python-idna noarch 2.4-1.el7 BASE 94 k python-ipaddress noarch 1.0.16-2.el7 BASE 34 k python-jinja2 noarch 2.7.2-4.el7 BASE 519 k python-markupsafe x86_64 0.11-10.el7 BASE 25 k python-paramiko noarch 2.1.1-9.el7 BASE 269 k python-ply noarch 3.4-11.el7 BASE 123 k python-pycparser noarch 2.14-1.el7 BASE 104 k python-setuptools noarch 0.9.8-7.el7 BASE 397 k python-six noarch 1.9.0-2.el7 BASE 29 k python2-cryptography x86_64 1.7.2-2.el7 BASE 502 k python2-httplib2 noarch 0.18.1-3.el7 epel 125 k python2-jmespath noarch 0.9.4-2.el7 epel 41 k python2-pyasn1 noarch 0.1.9-7.el7 BASE 100 k sshpass x86_64 1.06-2.el7 extras 21 k Transaction Summary ======================================================================================================================= Install 1 Package (+21 Dependent packages) Total download size: 21 M Installed size: 122 M
編譯安裝
yum -y install python-jinja2 PyYAML python-paramiko python-babel python-crypto wget https://releases.ansible.com/ansible/ansible-1.5.4.tar.gz tar xf ansible-1.5.4.tar.gz cd ansible-1.5.4 python setup.py build python setup.py install mkdir /etc/ansible cp -r examples/* /etc/ansible
pip 安裝
pip 是安裝Python包的管理器,類似 yum
[root@centos7 ~]#yum 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)] [root@centos7 ~]#ll /opt/etc/ansible/ansible.cfg -rw-r--r-- 1 wang bin 19980 Aug 11 21:34 /opt/etc/ansible/ansible.cfg