Ansible多种方法安装

/ Linux服务安装搭建 / 没有评论 / 1444浏览

地址

https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html

使用 pip(python的包管理模块)安装

首先,我们需要安装一个python-pip包,安装完成以后,则直接使用pip命令来安装我们的包,具体操作过程如下

 yum install python-pip
 pip install ansible

使用 yum 安装

较新的机器可以尝试直接安装

yum install epel-release -y
yum install ansible –y

Rpm包安装

# git clone https://github.com/ansible/ansible.git
# cd ./ansible
# make rpm
# sudo rpm -Uvh ./rpm-build/ansible-*.noarch.rpm

apt安装

# sudo apt-get update
# sudo apt-get install software-properties-common
# sudo apt-add-repository --yes --update ppa:ansible/ansible
# sudo apt-get install ansible

but 还有编译安装方法

编译安装

#下载包
wget http://releases.ansible.com/ansible/ansible-2.5.0a1.tar.gz

#解压
tar xf ansible-2.5.0a1.tar.gz

cd ansible-2.5.0a1
make && make  install 

ansible 配置公私钥

1.生成私钥

[root@server ~]# ssh-keygen 

2.向主机分发私钥

[root@server ~]# ssh-copy-id root@192.168.0.2
[root@server ~]# ssh-copy-id root@192.168.0.1

注意要是主机没有开通root登录,可以手动操作

End