1、安装Python 3.x环境

[root@ansible ~]# yum install -y python36 python36-pip git

[root@ansible ~]# ln -s /usr/bin/pip36 /usr/bin/pip3

[root@ansible ~]# pip install virtualenv

2、配置virtualenv环境(可选)

[deploy@ansible ~]$ useradd deploy && su - deploy

[deploy@ansible ~]$ virtualenv -p /bin/python3. .py3-a2.-env

[deploy@ansible ~]$ source .py3-a2.-env/bin/activate

3、从Github下载最新稳定版本代码

[root@localhost ~]# git clone -b stable-2.7 https://github.com/ansible/ansible.git
Cloning into 'ansible'...
remote: Enumerating objects: , done.
remote: Counting objects: % (/), done.
remote: Compressing objects: % (/), done.
remote: Total (delta ), reused (delta ), pack-reused
Receiving objects: % (/), 155.97 MiB | 4.54 MiB/s, done.
Resolving deltas: % (/), done.

4、安装ansible Python依赖包

[root@localhost ~]# pip3 install paramiko PyYAML jinja2
Collecting paramiko
Downloading https://files.pythonhosted.org/packages/cf/ae/94e70d49044ccc234bfdba20114fa947d7ba6eb68a2e452d89b920e62227/paramiko-2.4.2-py2.py3-none-any.whl (193kB)
% |████████████████████████████████| 194kB 976kB/s
Collecting PyYAML
Downloading https://files.pythonhosted.org/packages/9f/2c/9417b5c774792634834e730932745bc09a7d36754ca00acf1ccd1ac2594d/PyYAML-5.1.tar.gz (274kB)
% |████████████████████████████████| 276kB .2MB/s
Collecting jinja2
Downloading https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl (124kB)
% |████████████████████████████████| 133kB .3MB/s
Collecting pyasn1>=0.1. (from paramiko)
Downloading https://files.pythonhosted.org/packages/7b/7c/c9386b82a25115cccf1903441bba3cbadcfae7b678a20167347fa8ded34c/pyasn1-0.4.5-py2.py3-none-any.whl (73kB)
% |████████████████████████████████| 81kB .8MB/s
Collecting bcrypt>=3.1. (from paramiko)
Downloading https://files.pythonhosted.org/packages/d0/79/79a4d167a31cc206117d9b396926615fa9c1fdbd52017bcced80937ac501/bcrypt-3.1.6-cp34-abi3-manylinux1_x86_64.whl (55kB)
% |████████████████████████████████| 61kB .6MB/s
Collecting cryptography>=1.5 (from paramiko)
Downloading https://files.pythonhosted.org/packages/5b/12/b0409a94dad366d98a8eee2a77678c7a73aafd8c0e4b835abea634ea3896/cryptography-2.6.1-cp34-abi3-manylinux1_x86_64.whl (2.3MB)
% |████████████████████████████████| .3MB 506kB/s
Collecting pynacl>=1.0. (from paramiko)
Downloading https://files.pythonhosted.org/packages/27/15/2cd0a203f318c2240b42cd9dd13c931ddd61067809fee3479f44f086103e/PyNaCl-1.3.0-cp34-abi3-manylinux1_x86_64.whl (759kB)
% |████████████████████████████████| 768kB .6MB/s
Collecting MarkupSafe>=0.23 (from jinja2)
Downloading https://files.pythonhosted.org/packages/b2/5f/23e0023be6bb885d00ffbefad2942bc51a620328ee910f64abe5a8d18dd1/MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting cffi>=1.1 (from bcrypt>=3.1.->paramiko)
Downloading https://files.pythonhosted.org/packages/20/f7/87b62a8895bf7c93e907b05b97bc4459c81a38a61151f03a6eae13d863aa/cffi-1.12.2-cp36-cp36m-manylinux1_x86_64.whl (428kB)
% |████████████████████████████████| 430kB .0MB/s
Collecting six>=1.4. (from bcrypt>=3.1.->paramiko)
Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting asn1crypto>=0.21. (from cryptography>=1.5->paramiko)
Downloading https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
% |████████████████████████████████| 102kB .6MB/s
Collecting pycparser (from cffi>=1.1->bcrypt>=3.1.->paramiko)
Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB)
% |████████████████████████████████| 163kB .5MB/s
Installing collected packages: pyasn1, pycparser, cffi, six, bcrypt, asn1crypto, cryptography, pynacl, paramiko, PyYAML, MarkupSafe, jinja2
Running setup.py install for pycparser ... done
Running setup.py install for PyYAML ... done
Successfully installed MarkupSafe-1.1. PyYAML-5.1 asn1crypto-0.24. bcrypt-3.1. cffi-1.12. cryptography-2.6. jinja2-2.10. paramiko-2.4. pyasn1-0.4. pycparser-2.19 pynacl-1.3. six-1.12.
You are using pip version 9.0., however version 19.0. is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

5、安装ansible

[root@localhost ~]# ls
ansible [root@localhost ~]# cd ansible/ [root@localhost ansible]# ls
bin contrib docsite_requirements.txt lib MANIFEST.in README.rst shippable.yml
changelogs COPYING examples licenses MODULE_GUIDELINES.md requirements.txt test
CODING_GUIDELINES.md docs hacking Makefile packaging setup.py tox.ini [root@localhost ansible]# python3 setup.py install
running install
running bdist_egg
running egg_info
creating lib/ansible.egg-info
writing lib/ansible.egg-info/PKG-INFO
writing dependency_links to lib/ansible.egg-info/dependency_links.txt
writing requirements to lib/ansible.egg-info/requires.txt
writing top-level names to lib/ansible.egg-info/top_level.txt
writing manifest file 'lib/ansible.egg-info/SOURCES.txt'
reading manifest file 'lib/ansible.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'SYMLINK_CACHE.json'
writing manifest file 'lib/ansible.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
.
.
此处省略几百行
.
.
Using /usr/local/lib/python3./site-packages
Finished processing dependencies for ansible==2.7..post0

6、创建Ansible配置文件,并开启Ansible日志(Ansible默认不启用日志)

[root@localhost ~]# mkdir /etc/ansible
[root@localhost ~]# cp ansible/examples/ansible.cfg /etc/ansible/
[root@localhost ~]# sed -i 's/#log_path/log_path/' /etc/ansible/ansible.cfg

7、验证Ansible安装结果

[root@localhost ansible]# ansible --version
ansible 2.7..post0
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3./site-packages/ansible-2.7..post0-py3..egg/ansible
executable location = /usr/local/bin/ansible
python version = 3.6. (default, Apr , ::) [GCC 4.8. (Red Hat 4.8.-)]

CentOS 7 源码安装Ansible 2.x的更多相关文章

  1. CentOS下源码安装Apache2.4+PHP5.4+MySQL5.5

    一.准备(把所有的源文件放在‘/home/yuanjun’目录下) apr http://mirror.bjtu.edu.cn/apache/apr/apr-1.4.6.tar.gz apr-util ...

  2. 源码安装Ansible

    一.Ansible介绍 ansible是一款的自动化运维工具,基于Python开发,集合了众多运维工具(puppet.cfengine.chef.func.fabric)的优点,实现了批量系统配置.批 ...

  3. Linux 源码安装Ansible 参考篇

    Ansible 源码搭建配置 近期在学习自动化运维相关技术,文章主要模拟内网情况下对Ansible的安装演示,源码安装较为繁琐.枯燥,尤其是在实际安装过程中可能出现各式各样的问题,所有在安装过程中尽量 ...

  4. CentOS下源码安装vsftpd-3.0.0,并设置指定用户访问指定目录(附带完整配置文件)

    1.卸载系统已经存在的ftp服务器 因为是源码安装,所以不能通过rpm -qa的方式查看是否已经安装ftp服务器,可以通过find / | grep vsftp*方式查看系统中存在哪些与vsftpd相 ...

  5. 在 CentOS 下源码安装 Xen

    http://www.vpsee.com/2010/04/install-xen-on-centos-from-source/ 在 CentOS 源码编译安装 Xen 的过程和在 Debian 上编译 ...

  6. Centos下源码安装git

    1.centos下git版本太久了,才1.8几,而官方更新的还是很活跃的,于是我就想源码安装一个新版本. 2.首先到: https://github.com/git/git/releases 下载最新 ...

  7. centos上源码安装clang 3.8

    之前想在centos系统上安装clang 3.6版本,由于yum上版本太低,想通过源码编译安装.按照网上说的源码安装步骤,下好llvm.clang.clang-tools-extra和compiler ...

  8. centos环境源码安装postgresql9.4

    源码安装简要步骤 下载PostgreSQL 源码包  下载根目录地址:http://ftp.postgresql.org/  本人选择的是当前最新版本v9.4.1:http://ftp.postgre ...

  9. centos 7 源码安装gogs

    gogs 是轻量级的私有git 平台,允许个人通过低配置的服务器安装私有git gogs 的官网地址是:https://gogs.io/ 安装步骤 1)源码安装mysql 2)  源码安装git 3) ...

随机推荐

  1. p​h​p​面​试​题​笔​试​题​ ​比较有用

    一.选择题1.php的源代码是 (A )A.开放的 B.封闭的 C.需购买的 D.完全不可见的2.php的输出语句是 ( C )A.out.print B.response.write C.echo ...

  2. npm安装express 公司上网设置代理

    异常: 0 info it worked if it ends with ok1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\\\node.exe' ...

  3. Android中自动跳转到系统设置界面

    // 转到手机设置界面,用户设置GPS Intent intent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActi ...

  4. JZOJ.5257【NOIP2017模拟8.11】小X的佛光

    Description

  5. linux的bash与sh的区别

    转自:https://zhidao.baidu.com/question/305415121.html https://zhidao.baidu.com/question/176780008.html ...

  6. MyBatis 映射文件详解

    1. MyBatis 映射文件之<select>标签 <select>用来定义查询操作; "id": 唯一标识符,需要和接口中的方法名一致; paramet ...

  7. Java 集合框架查阅技巧

    如何记录每一个容器的结构和所属体系呢? List ArrayList LinkedList Set HashSet TreeSet 其中,后缀名就是该集合所属的体系,前缀名就是该集合的数据结构. 看到 ...

  8. Java 之异常

    异常概述 异常: 是在运行时期发生的不正常情况. 在 java 中用类的形式对不正常情况进行了描述和封装. 描述不正常情况的类, 就称为异常类. 异常体系 父类: Throwable (JDK 文档) ...

  9. NYOJ 119 士兵杀敌(三)(RMQ算法)

    採用的的是小牛的写法,蒟蒻第一次写.. RMQ (Range Minimum/Maximum Query)问题是指:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j<=n).返回数 ...

  10. Hibernate缓存原理

    对于Hibernate这类ORM而言,缓存显的尤为重要,它是持久层性能提升的关键. 简单来讲Hibernate就是对JDBC进行封装,以实现内部状态的管理,OR关系的映射等, 但随之带来的就是数据访问 ...