当前位置:网站首页>Ansible introduction (detailed) features + advantages + design concept + application field + system architecture + working principle + task execution process
Ansible introduction (detailed) features + advantages + design concept + application field + system architecture + working principle + task execution process
2022-07-30 03:04:00 【Hanhan|】
前言
The traditional operations and automatic operations
传统运维带来的坑
运维工作是比较繁琐的,尤其是新系统上线的场景,一切都是从零开始.Including the virtual machine to create,主机名的修改,系统的初始化等等,Under the condition of the machine is not much artificial also can,如果有上百台机器呢?最初也是用堆人的方法来做的.But the high error rate this way,而且有时还会有遗漏.只能通过相互检查的方式来验证,但这样就会花费更多的时间,相应的时间/人工成本也会上升.
人工的方式因个人部署习惯千差万别,导致一些项目难以维护.运维自动化
没有专门的工具为我们做这些事情,使用脚本语言(Python)
逐渐有了运维自动化的一些工具,比如Fabric、Puppet、Chef SaltStack、AnsibleSuch as automated operations platform.
目录
The traditional operations and automatic operations
Ansible介绍
1、Ansible简介
ansible是新出现的自动化运维工具,基于Python开发,集合了众多老牌运维工具(puppet、cfengine chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能.
ansible是基于模块工作的,本身没有批量部署的能力.真正具有批量部署的是ansible所运行的模块, ansible只是提供一种框架.主要包括:
- 连接插件connection plugins:负责和被管控端实现通信;
- host inventory:指定操作的主机,是一个配置文件里面定义管控的主机;
- 各种模块核心模块、command模块、自定义模块;
- 借助于插件完成记录日志邮件等功能;
- playbook:剧本执行多个任务时,可以让被管控端一次性运行多个任务.
1、Ansible特性
- no agents:不需要在被管控主机上安装任何客户端;
- no server:无服务器端,使用时直接运行命令即可;
- modules in anylanguages:基于模块工作,可使用任意语言开发模块;
- yaml,notcode:使用yaml语言定制剧本playbook;
- ssh by default:基于SSH工作;
- strong multi-tier solution:可实现多级指挥.
2、Ansible优点
- 轻量级,无需在客户端安装agent,更新时,只需在操作机上进行一次更新即可;
- 批量任务执行可以写成脚本,而且不用分发到远程就可以执行;
- 使用python编写,维护更简单,ruby语法过于复杂;
- 支持sudo.
3、Ansible设计理念
- 安装部署过程特别简单, 学习曲线很平坦.
- Management convenient host, Support multiple hosts in parallel management.
- Avoid install client proxy in the managed host, Open additional port,采用无代理方式,只是利用现有的 SSH后台进程.
- Language for describing the infrastructure for both the machine and the people are friendly.
- 关注安全,Very easy to perform the content of the audit、评估、重写.
- Able to manage remote immediately managed host, Do not need to install any software in advance.
- 不仅仅支持Python,Can be run using any dynamic language development module.
- 非 root Account can also use.
- 成为最简单、易用的 IT自动化系统
4、 Ansible 应用领域
Ansible的编排引擎可以出色地完成配置管理、流程控制 、资源部署等多方面工作.
1.配置管理
2.服务即时开通
这个领域的工具主要是在数据中心 、虚拟化环境、云计算中快速开通新的主机.
3.应用部署
Tools in this field focus on how to zero downtime to deploy applications as much as possible.
4.流程编排
流程编排主要是进行部署时候如何保证基础架构中的各种组件协调一致.
5、Ansible系统架构
1.The core engineAnsible
2.核心模块:(Core Modules):这些都是Ansible自带的模块.
3.自定义模块(Custom Modules):如果核心模块不足以完成某种功能,可以添加自定义模块.
4.插件(Plugins):完成模块功能的补充,借助插件完成记录日志,Mail, etc.
5.剧本(Playbooks):定义Ansible任务的配置文件,可以将多个任务定义在一个剧本中,有Ansible自动执行,Script to support multiple tasks,Can control host by running multiple position,同时对多台远程主机进行管理.
6.Playbook是Ansible的配置、部署和编排语言,Can describe a remote system execution strategy you want.或一组步骤的一般过程.
7.连接插件(Connectior plugins):Ansible基于连接插件连接到各个主机上,负责和被管节点实现通信.
8.主机清单(host inventory):定义Ansible管理的主机策略,默认是在Ansible的hosts配置文件中定义被管节点.
6、Ansible工作原理
1.管理端支持local、ssh、zeromq三种方式连接被管理端,默认使用基于ssh的连接---这部分对应基本架构图中的连接模块;
2.可以按应用类型等方式进行Host Inventory(主机群)分类,管理节点通过各类模块实现相应的操作 ---单个模块,单条命令的批量执行,我们可以称之为ad-hoc;
3 .管理节点可以通过playbooks实现多个task的集合实现一类功能,如web服务的安装部署、数据库服务器的批量备份等.playbooks我们可以简单的理解为,系统通过组合多条ad-hoc操作的配置文件.
Ansible默认是通过SSH通道来管理的,That is what it said since from the client to manage,它底层是通过paramiko(paramiko模块)来实现的.
7、Ansible任务执行流程
总结
以上就是今天要讲的内容,本文介绍了
- Automation is to reduce the human error and quickly make sureIT基础架构处于一致且正确的状态的关键工具.
- Ansible是一种开源自动化平台,能够适应许多不同的工作流和环境.
- AnsibleCan be used for many different types of management system,包括运行Linux、MicrosoftWindows或UNIX的服务器以及网络设备.
- AnsiblePlaybook是人类可读的文本文件,用于描述IT基础架构的所需状态.
- Ansible围绕一种无代理架构构建,在控制节点上安装Ansible,且客户端不需要任何特殊的代理软件.
- Ansible使用SSH等标准协议连接受管主机,并在受管主机上运行代码或命令来确保它们处于 Ansible指定的状态.
边栏推荐
- B. Inflation-Educational Codeforces Round 103 (Rated for Div. 2)
- 【机器学习】通俗易懂决策树(原理篇)
- Dell's first pure soft product redefines next-generation object storage
- Redis (ten) - Redission principle and practice
- nrm ls 为什么前面不带 *了
- 三年经验只会点点点(功能测试),辞职后你可能连工作都找不到了。
- 戴尔首款纯软产品,再定义下一代对象存储
- 一个塑料瓶的海洋“奇幻漂流”
- A transaction is in Mysql?What's the use?
- 自定义 View 实现汉字笔顺动画
猜你喜欢
黑客动态播报 | 一封假offer,盗取6.25亿美元
QT based on the third day (3) widget, dialog and mainwindow
JUC (four): five/six states of shorthand thread
1050 graphics card, why is the graphics card usage ranking on Steam always the top five
【MySQL】SQL学习
复星医药募资44.84亿:高毅资产认购20亿 成第三大股东
JIT VS AOT
杜教筛【莫比乌斯前缀和,欧拉函数前缀和】推导与模板【一千五百字】
Oracle 进程数和会话数的关系
First acquaintance with the web
随机推荐
Detailed explanation of carousel picture 2 - carousel pictures through left positioning
3.nodejs--模块化
测试人员,除了测试还得会点什么
Nuxt3学习
实现导入市场活动:
浏览器缓存机制
HCIP 第十四天
实现批量导出功能
JUC (7): Thread Safety Analysis of Variables
【基于RT-Thread+RA6M4的智能鱼缸系统设计之鱼我所欲也】
一本通1922——乒乓球
还在用命令行看日志?快用Kibana吧,可视化日志分析YYDS
【服务器存储数据恢复】华为OceanStor某型号存储raid5数据恢复案例
雪花是否一样问题
NLP自然语言处理(二)
黑客动态播报 | 一封假offer,盗取6.25亿美元
Three years of experience will only be a little bit (functional testing), and you may not even be able to find a job after resigning.
博客搭建十:hugo博客添加友链
Successfully resolved pydotplus.graphviz.InvocationException: GraphViz's executables not found
Awesome, Tencent technical experts handed Redis technical notes, and the download volume has exceeded 30W