zoukankan      html  css  js  c++  java
  • Centos7搭建ansible运维自动化工具

    1)设置主机名和hosts文件

    2)配置阿里云repo

    Wget -O /etc/yum.repos.d/aliyun.repo https://mirrors.aliyun.com/repo/Centos-7.repo

    3)创建ssh免交互登录

    [root@ansible ~]# ssh-keygen -t rsa -P "" -f .ssh/id_rsa

    [root@ansible ~]# sshpass -p 666666 ssh root@192.168.30.24 -o StrictHostKeyChecking=no

    [root@ansible ~]# sshpass -p 666666 ssh-copy-id root@192.168.30.24 -o StrictHostKeyChecking=no

    测试

    [root@ansible ~]# ssh root@192.168.30.25

    Last login: Wed May 15 17:07:10 2019 from ansible

    [root@client1 ~]# hostname

    client1

    [root@client1 ~]# exit

    登出

    4)/etc/ansible/hosts文件中添加管理主机组,以后可根据组成员进行批量管理

    vim /etc/ansible/hosts

    [cloud]

    192.168.30.25

    192.168.30.26

    [root@ansible ~]# ansible cloud -m ping

    client1 | SUCCESS => {

        "changed": false,

        "ping": "pong"

    }

    [root@ansible ~]# ansible cloud -a "free -m"

    client1 | SUCCESS | rc=0 >>

                  total        used        free      shared  buff/cache   available

    Mem:           1982         959          84          15         939         696

    Swap:          2047         365        1682

  • 相关阅读:
    百度图片
    在线人数统计
    mysql简易导入excel
    asp.net 导出excel带图片
    C# 正则验证
    js生成随机数
    YQL获取天气
    取html里的img和去html标签
    客户端信息获得《转》
    使用ASP.NET上传图片汇总
  • 原文地址:https://www.cnblogs.com/zc1741845455/p/10881007.html
Copyright © 2011-2022 走看看