CentOS 7 安装 Ansible

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常用模块详解

https://blog.csdn.net/qq_34646546/article/details/86606408

 

 

 

你可能感兴趣的:(Automated,Ops)