yum 安装
[[email protected] ~]# yum -y install epel-release [[email protected] ~]# yum -y install ansible [[email protected] ~]# ansible --version ansible 2.7.5 config file = /etc/ansible/ansible.cfg 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,Oct 30 2018,23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
至此ansible安装完成!!!
源码安装
安装依赖的包 [[email protected] ~]# yum -y install python-jinja2 python-paramiko PyYAML python-bable python-cypto wget 下载ansible源码包(在github下载的) [[email protected] ~]# wget https://github.com/ansible/ansible/archive/v2.7.5.tar.gz 解压 [[email protected] ~]# tar zxf v2.7.5.tar.gz [[email protected] ~]# cd ansible-2.7.5/ 安装 [[email protected] ansible-2.7.5]# python setup.py build [[email protected] ansible-2.7.5]# python setup.py install [[email protected] ansible-2.7.5]# mkdir /etc/ansible [[email protected] ansible-2.7.5]# cp -r examples/* /etc/ansible/ 查看是否安装成功 [[email protected] ansible-2.7.5]# ansible --version ansible 2.7.5 config file = /etc/ansible/ansible.cfg 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-2.7.5-py2.7.egg/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default,23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)
至此ansible安装完成!!!
Git安装
安装依赖的包 [[email protected] ~]# yum -y install epel-release [[email protected] ~]# yum -y install python-jinja2 python-paramiko PyYAML python-bable python-cypto wget git 下载ansible [[email protected] ~]# git clone git://github.com/ansible/ansible.git --recursive [[email protected] ~]# cd ansible/ [[email protected] ansible]# source ./hacking/env-setup [[email protected] ansible]# ansible --version ansible 2.8.0.dev0 (devel 4fe346da18) last updated 2018/12/23 14:44:26 (GMT +800) config file = None configured module search path = [u‘/root/.ansible/plugins/modules‘,u‘/usr/share/ansible/plugins/modules‘] ansible python module location = /root/ansible/lib/ansible executable location = /root/ansible/bin/ansible python version = 2.7.5 (default,23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)
至此ansible安装完成!!!
Pip安装
[[email protected] ~]# yum -y install epel-release [[email protected] ~]# yum -y install python-devel python-pip gcc glibc-devel zibl-devel rpm-build openssl-devel [[email protected] ~]# pip install --upgrade pip [[email protected] ~]# pip install ansible --upgrade [[email protected] ~]# ansible --version ansible 2.7.5 config file = None configured module search path = [u‘/root/.ansible/plugins/modules‘,23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
至此ansible安装完成!!!
Ansible使用
ansbile的基础使用及配置文件详情:https://www.cnblogs.com/brianzhu/p/10164379.html