ansible-安装与使用

1.安装ansible:

环境为centos7。

1) epel

采用阿里源的epel。安装方式连接:http://mirrors.aliyun.com/help/epel

2)yum install -y ansible

查看安装成功: ansible --help

 

2.ansible 测试

1)本机ssh无密码登录

>ssh-keygen

>cat id_rsa.pub > authorized_keys

  测试:ssh -l root localhost 登录成功

2)在ansible的host中增加本机

vi /etc/ansible/hosts

在localhost增加本机ip。我的pc地址为172.125.1.20。

3)ansible localhost -m ping
得到结果

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

证明ansible安装成功。

   

posted @ 2016-12-21 20:55  奔跑吧大龙  阅读(227)  评论(0编辑  收藏  举报