iralance / myblog

notes
0 stars 0 forks source link

ansible自动化 #22

Open iralance opened 7 years ago

iralance commented 7 years ago

安装

  1. yum安装(centos7)
    rpm -Uvh http://mirrors.zju.edu.cn/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
    或者
    yum install http://mirrors.sohu.com/fedora-epel/7/x86_64/a/ansible-2.3.1.0-1.el7.noarch.rpm
    yum install ansible

    2.brew安装

    brew install ansible

    3.apt安装

    apt-get install software-properties-common
    apt-add-repository ppa:ansible/ansible
    apt-get update
    apt-get install ansible

    4.pip安装

    sudo easy_install pip
    pip install ansible

使用

编辑/etc/ansible/hosts文件,添加被管理的远程主机:

[merge]
103.242.0.51

查看:

a1

管理远程服务器:

自动化

上面操作完成后,服务器B先clone代码后,在服务器A执行即可实现批量更新 a3

参考