1、如果要安装的服务器能够连接互联网
pip install ansible
2、如果要安装的服务器不能够连接互联网
在一台能够下载的服务器下载文件:
pip install –download “pathofdownload” ansible
将下载后的 python 组建copy 到需要安装的服务器,执行以下步骤安装
pip install –no-index –find-links=“pathofdownload” ansible
3、配置 ssh 公私钥对
ssh-keygen
ssh-copy-id -i /root/.ssh/id_rsa.pub root@hostname
4、配置 /etc/ansible/hosts 文件,添加主机列表
5、配置/etc/ansible/ansible.cfg,添加一下内容
[defaults]
host_key_checking = False
放置进行 ssh 操作的时候出现密钥纠正提示的 yes or no 信息。