Ansible - 2.架构图以及工作原理

1. ansible架构图及各组件功能

ansible Architecture

可以了解到ansible由以下部分组成:

  • 核心:ansible
  • 核心模块(Core Modules):这些都是ansible自带的模块
  • 扩展模块(Custom Modules):如果核心模块不足以完成某种功能,可以添加扩展模块
  • 插件(Plugins):完成模块功能的补充
  • 剧本(Playbooks):ansible的任务配置文件,将多个任务定义在剧本中,由ansible自动执行
  • 连接插件(Connectior Plugins):ansible基于连接插件连接到各个主机上,虽然ansible是使用ssh连接到各个主机的,但是它还支持其他的连接方法,所以需要有连接插件
  • 主机群(Host Inventory):定义ansible管理的主机

2. ansible工作原理

ansible workflow

Ansible works by connecting to your nodes and pushing out small programs, called "Ansible modules" to them. Ansible then executes these modules (over SSH by default), and removes them when finished. Your library of modules can reside on any machine, and there are no servers, daemons, or databases required.

The management node in the above picture is the controlling node (managing node) which controls the entire execution of the playbook. It’s the node from which you are running the installation. The inventory file provides the list of hosts where the Ansible modules needs to be run and the management node does a SSH connection and executes the small modules on the hosts machine and installs the product/software.

3. ansible执行流程

ansible run Seq

4. 注意事项

  • 执行ansible的主机一般称为主控端/中控/master或堡垒机
  • 主控端Python版本需要2.6或以上
  • 被控端Python版本小于2.4需要安装Python-smplejson
  • 被控端如何开启SELinux需要安装libselinux-python
  • windows不能作为主控端
posted @ 2021-11-03 11:07  兜儿~  阅读(165)  评论(0编辑  收藏  举报