zoukankan      html  css  js  c++  java
  • 在centOS 7 上部署ansible自动化运维环境(01)

    环境:
            3台centos 7       
       mycat :      10.0.0.2
       mariadb1:    10.0.0.3
       mariadb2:    10.0.0.4
           为了实验方便 firewalld、selinux均处于关闭状态
    [root@mycat ~]# systemctl stop firewalld    
    [root@mycat ~]# systemctl disable firewalld
    [root@mycat ~]# setenforce 0
            hosts文件均添加如下映射:
            10.0.0.2        mycat
            10.0.0.3        mariadb1
            10.0.0.4        mariadb2
    1、安装 ansible工具
    [root@mycat ~]# yum -y install ansible
    2、设置ssh免密登陆
    [root@mycat ~]# ssh-keygen                                              // 生成密钥
    [root@mycat ~]# ssh-copy-id -i .ssh/id_rsa.pub root@***ip***           // 把密钥导入   
    [root@mycat ~]# ssh ***ip***                                          //  登陆
    [root@mariadb1 ~]# exit                                              //   登出
    3、修改/etc/ansible/hosts文件,添加管理主机组,以后可根据组成员进行批量操作
    [root@mycat ~]# vim /etc/ansible/hosts
     
    [mariadb]                        //名为mariadb的主机组,包含 0.3、0.4两台主机
    10.0.0.3
    10.0.0.4
     
     
    [mycat]                          //名为mycat的组机组,包含0.2主机
    10.0.0.2
    4、用ping模块测试
    [root@mycat ~]# ansible mariadb -m ping
    10.0.0.4 | SUCCESS => {
        "changed": false,
        "ping": "pong"
    }
    10.0.0.3 | SUCCESS => {
        "changed": false,
        "ping": "pong"
    }
  • 相关阅读:
    Linux系统安装Apache 2.4.6
    Redhat Server 5.7 安装配置PHP
    ORACLE基本数据类型总结
    Nagios学习实践系列——产品介绍篇
    Linux技术修复
    python的特殊方法:
    python获取对象信息
    python多重继承:
    python多态
    python类的继承
  • 原文地址:https://www.cnblogs.com/BrotherCat/p/11254875.html
Copyright © 2011-2022 走看看