ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。
配置
192.168.1.73 ansible
192.168.1.114 client
192.168.1.115 client
1、安装
yum install epel-release -y
yum install ansible -y
2、配置 ssh
ssh-keygen
ssh-copy-id [email protected]
ssh-copy-id [email protected]
3、添加主机列表
vi /etc/ansible/hosts
[testgroup]
192.168.1.114
192.168.1.115
4、批量ping
ansible testgroup -m ping
192.168.1.115 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
192.168.1.114 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
5、批量安装 wget
ansible testgroup -m shell -a "yum install wget -y"
6、批量拷贝
ansible testgroup -m copy -a "src=/root/anaconda-ks.cfg dest=/opt"
7、Ansible常用模块详解
标签:Ansible,testgroup,CentOS,批量,python,192.168,ansible,1.114,安装 From: https://blog.51cto.com/u_14508118/5857665