yxsailing 发表于 2018-1-3 10:51:04

ansible 安装及基本使用

  1、yum 安装
  

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

  ansible 配置秘钥
  

ssh-keygen -t rsa   #直接回车不用设置密码  

  

  公钥copy 到需要批量的主机上
  

# ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.99.130  
# ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.99.180
  

  

  2、ansible 基本使用
  (1)ansible 执行远程命令
  

# ansible -i /etc/ansible/hostname all -m command -a 'hostname'  
192.168.99.180 | SUCCESS | rc=0 >>
  
ansible.vick02.com
  

  
192.168.99.130 | SUCCESS | rc=0 >>
  
ansible.vick01.com
  

  
页: [1]
查看完整版本: ansible 安装及基本使用