Ansible--安装

yum 安装

[root@ansible ~]# yum -y install epel-release
[root@ansible ~]# yum -y install ansible
[root@ansible ~]# 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安装完成!!!

源码安装

安装依赖的包
[root@ansible ~]# yum -y install python-jinja2 python-paramiko PyYAML python-bable python-cypto wget

下载ansible源码包(在github下载的)
[root@ansible ~]# wget https://github.com/ansible/ansible/archive/v2.7.5.tar.gz

解压
[root@ansible ~]# tar zxf v2.7.5.tar.gz
[root@ansible ~]# cd ansible-2.7.5/

安装
[root@ansible ansible-2.7.5]# python setup.py build
[root@ansible ansible-2.7.5]# python setup.py install
[root@ansible ansible-2.7.5]# mkdir /etc/ansible
[root@ansible ansible-2.7.5]# cp -r examples/* /etc/ansible/

查看是否安装成功
[root@ansible 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, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)

 至此ansible安装完成!!!

Git安装

安装依赖的包
[root@ansible ~]# yum -y install epel-release
[root@ansible ~]# yum -y install python-jinja2 python-paramiko PyYAML python-bable python-cypto wget git

下载ansible
[root@ansible ~]# git clone git://github.com/ansible/ansible.git --recursive
[root@ansible ~]# cd ansible/
[root@ansible ansible]# source ./hacking/env-setup
[root@ansible 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, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)

 至此ansible安装完成!!!

Pip安装

[root@ansible ~]# yum -y install epel-release
[root@ansible ~]# yum -y install python-devel python-pip gcc glibc-devel zibl-devel rpm-build openssl-devel
[root@ansible ~]# pip install --upgrade pip
[root@ansible ~]# pip install ansible --upgrade
[root@ansible ~]# ansible --version
ansible 2.7.5
  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, Oct 30 2018, 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

posted @ 2018-12-23 14:54  Brian_Zhu  阅读(492)  评论(0编辑  收藏  举报