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

  • 相关阅读:
    uva-11361
    HDU
    LCS
    CodeForces
    linux 有趣的命令组合
    opencv识别封闭区域 并标记该区域
    宜出行人口热力图
    美团酒店
    赶集租房
    发送企业微信应用通知
  • 原文地址:https://www.cnblogs.com/zc1741845455/p/10881007.html
Copyright © 2011-2022 走看看