zoukankan      html  css  js  c++  java
  • 1.ansible概述安装定义主机组

    ansible批量管理服务概述
    ansible批量功能          -- 并行
    01. 可以实现批量系统操作配置
    02. 可以实现批量软件服务部署
    03. 可以实现批量文件数据分发
    04. 可以实现批量系统信息收集
    ansible批量管理服务意义   
    01. 提高工作的效率(部署综合架构)  
    02. 提高工作准确度
    03. 减少维护的成本
    04. 减少重复性工作 
    
    ansible软件安装部署 saltstack自动化批量管理软件 (复杂(安装 配置 应用)) 软件服务比较重
    特点:
    1. 没有配置文件(不需要配置)
    2. 不需要启动服务
    3. 客户端没有需要部署任务
    
    管理服务器:
    第一个历程:安装ansible软件
    yum install -y ansible   -- epel
    
    ansible软件配置应用
    ansible软件功能组成模块:
    1)主机清单功能模块 /etc/ansible/hosts
    2)剧本功能模块  ansible-playbook
    3)核心或自定义模块 
    4)插件功能(python)
    

    ①主机清单

    vim /etc/ansible/hosts
    192.168.1.201
    192.168.1.202
    192.168.1.203
    192.168.1.204
    192.168.1.205
    192.168.1.214
    192.168.1.240
    192.168.1.241
    

    检查

    root@XTTD-2020YSWIII:~# ansible all -m ping
    192.168.1.201 | SUCCESS => {
        "changed": false,
        "ping": "pong"
    }
    192.168.1.202 | SUCCESS => {
        "changed": false,
        "ping": "pong"
    }
    192.168.1.205 | SUCCESS => {
        "changed": false,
        "ping": "pong"
    }
    192.168.1.204 | SUCCESS => {
        "changed": false,
        "ping": "pong"
    }
    192.168.1.203 | SUCCESS => {
        "changed": false,
        "ping": "pong"
    }
    
    定义主机组
    vim  /etc/ansible/hosts
    [k8s_proxy]
    192.168.1.201
    192.168.1.202
    [k8s_apiserver]
    192.168.1.203
    192.168.1.204
    [k8s_node]
    192.168.1.205
    192.168.1.214
    192.168.1.240
    192.168.1.241
    [root@rstx-53 scripts]# ansible k8s_apiserver  -m  ping 
    192.168.1.204 | SUCCESS => {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python"
        }, 
        "changed": false, 
        "ping": "pong"
    }
    192.168.1.203 | SUCCESS => {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python"
        }, 
        "changed": false, 
        "ping": "pong"
    }
    

    ip范围定义

    [test]
    192.168.1.[201:205]
    

    内置变量配置连接信息

    支持内置变量信息配置
    [oldboy]
    172.16.1.7  ansible_user=root ansible_password=123456 ansible_port=22
    

    支持特殊变量信息配置 (剧本)

    [oldboy]
    172.16.1.7
    [oldboy:vars]
    ansible_user=root 
    ansible_password=123456 
    ansible_port=22
    

    嵌入式配置方法

    vim /etc/ansible/hosts
    [k8s:children]
    k8s_proxy
    k8s_apiserver
    k8s_node
    
    [k8s_proxy]
    192.168.1.201
    192.168.1.202
    [k8s_apiserver]
    192.168.1.203
    192.168.1.204
    [k8s_node]
    192.168.1.205
    192.168.1.214
    192.168.1.240
    192.168.1.241
    [root@rstx-53 scripts]# ansible k8s -m ping 
    192.168.1.202 | SUCCESS => {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python"
        }, 
        "changed": false, 
        "ping": "pong"
    }
    192.168.1.201 | SUCCESS => {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python"
        }, 
        "changed": false, 
        "ping": "pong"
    }
    192.168.1.205 | SUCCESS => {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python"
        }, 
        "changed": false, 
        "ping": "pong"
    }
    192.168.1.204 | SUCCESS => {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python"
        }, 
        "changed": false, 
        "ping": "pong"
    }
    192.168.1.203 | SUCCESS => {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python"
        }, 
        "changed": false, 
        "ping": "pong"
    }
    
  • 相关阅读:
    Python中append和extend的区别
    python学习 day19
    python学习 day18
    QT下编写使用for循环动态添加刻选择时间类型的按钮(记录一下)
    QT mingw编译器下使用snap7库与西门子200smart-PLC(网口)通信实现代码
    看着挺胖的大胖猫
    QT添加软键盘后,QDialog设置模态后软键盘没响应解决办法
    QT程序打包在别的电脑上运行提示“api-ms-win-crt-runtime-|1-1-0.dll"可能与您正在运行的Window版本不兼容。。。。。
    Qt使用WM_COPYDATA消息进行进程通信
    离线百度地图,QT添加按钮点击切换卫星地图和街道地图
  • 原文地址:https://www.cnblogs.com/yangtao416/p/14580817.html
Copyright © 2011-2022 走看看