ansible安装

简介: 环境centos7.0:默认安装python2.6[root@10-15-195-231 ~]# rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.

环境centos7.0:默认安装python2.6
[root@10-15-195-231 ~]# rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
[root@10-15-195-231 ~]#yum install ansible
[root@10-15-195-231 ~]# ansible --version
ansible 2.2.0.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
如有报错请查看报错内容,如缺少cryptography
[root@10-15-195-231 ~]# pip install cryptography
[root@10-15-195-231 ~]#ssh-keygen
创建公钥一路回车即可,将.ssh/id_rsa_pub放至测试机的/root/.ssh/authorized_keys 中实现密钥登录
[root@10-15-195-231 ~]# cd /etc/ansible/
[root@10-15-195-231 ansible]# ls
ansible.cfg hosts roles
在hosts里配置测试服务器,还可以设子组,还可以自动添加一串相数字或字母临的服务器;hosts可以有多个如ansible -i hosts -m ping表示PING当前目录HOSTS里的机器
[1:3].linuxtoy.org # 等价于
1.linuxtoy.org、2.linuxtoy.org、3.linuxtoy.org
[a:c].linuxtoy.org # 等价于
a.linuxtoy.org、b.linuxtoy.org、c.linuxtoy.org
[root@10-15-195-231 ansible]# cat hosts
[nginx]
10.15.100.55
[test-server]
10.15.66.32
[vps:children]
test-server
nginx
做PING测试
[root@10-15-195-231 ansible]# ansible -m ping all
10.15.66.32 | SUCCESS => {

"changed": false, 
"ping": "pong"

}

目录
相关文章
|
4月前
|
Kubernetes Shell 网络安全
ansible的安装和简单的块使用
Ansible是一种自动化工具,用于配置管理、应用程序部署和协调云部署。它是一个开源工具,使用Python编写,通过SSH协议与远程主机通信。
121 2
ansible的安装和简单的块使用
|
Linux 开发工具
centos7脚本离线化安装CDH6.3版本(ansible闪亮登场~~~)(二)
centos7脚本离线化安装CDH6.3版本(ansible闪亮登场~~~)
200 0
centos7脚本离线化安装CDH6.3版本(ansible闪亮登场~~~)(二)
|
缓存 Linux
yum安装ansible报错如何解决
本篇内容记录了yum安装ansible报错的解决方案。
1025 0
yum安装ansible报错如何解决
|
8月前
|
缓存
yum install ansible无法直接安装Ansible的解决方法
准备三台机器: server.example.com node1.example.com node2.example.com 配置IP,主机名,/etc/hosts
300 0
|
8月前
|
运维 Ubuntu 应用服务中间件
【运维知识进阶篇】Ansible自动化运维-Ansible安装与主机列表
【运维知识进阶篇】Ansible自动化运维-Ansible安装与主机列表
116 0
|
11月前
|
Kubernetes 负载均衡 Docker
ansible学习之旅(ansible依托kubeadm安装一个简单的k8s集群)
ansible学习之旅(ansible依托kubeadm安装一个简单的k8s集群)
119 0
|
网络安全 数据安全/隐私保护
ansible安装及免密
ansible安装及免密
270 0
|
Web App开发 消息中间件 存储
|
运维 Python
如何安装ansible
如何安装ansible
224 0
|
网络安全 Python
Ansible 安装测试
Ansible 安装测试
153 0
Ansible 安装测试