Centos7安装配置ansible

安装ansible
yum -y install ansible
配置修改

打开配置文件ansible.cfg

vim /etc/ansible/ansible.cfg

插入以下信息:

inventory = /etc/ansible/hosts
log_path = /etc/ansible/ansible.log
forks          = 8           #执行时并发数
host_key_checking = False    #不检测host key
录入管理主机信息

打开主机管理文件hosts

vim /etc/ansible/hosts

配置远程主机列表,如以下配置,表示管理主机为10.1.1.1,主机分组为test:

[test]
10.1.1.1 ansible_ssh_port=22 ansible_ssh_user=ansible ansible_ssh_pass="123" 
配置测试

运行以下命令:

ansible test -m ping

返回结果如下,说明服务器对接成功

10.1.1.1 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}

你可能感兴趣的:(Centos7安装配置ansible)