Centos7 自动化工具 Ansible 安装配置

来源:互联网 发布:win7开启443端口 编辑:程序博客网 时间:2024/06/01 08:01

实验目的使用一台服务器安装Ansible来管理另外两台
Ansible服务端:192.168.31.10
节点:192.168.31.20 192.168.31.21

安装Ansible

1.安装elep源

yum -y install epel-release

2.安装Asible

yum -y install ansible

配置

1.设置ssh密钥,复制公钥到节点

ssh-keygen #一路回车生成密钥ssh-copy-id -i root@192.168.31.20ssh-copy-id -i root@192.168.31.21

2.配置ansible文件 /etc/ansible/hosts

[test-servers]192.168.31.20192.168.31.21

3.测试ansible

[root@qian1 ~] ansible -m ping 'test-servers'192.168.31.21 | SUCCESS => {    "changed": false,     "ping": "pong"}^H192.168.31.20 | SUCCESS => {    "changed": false,     "ping": "pong"}
原创粉丝点击