Ansible (软件)

维基百科,自由的百科全书
Ansible
原作者Michael DeHaan
开发者Ansible 社群 / Ansible Inc. / Red Hat Inc.
首次发布2012年2月20日,​12年前​(2012-02-20
当前版本
  • 2.16.6 (2024年4月15日;稳定版本)[1]
编辑维基数据链接
源代码库 编辑维基数据链接
编程语言Python, PowerShell, Shell, Ruby
操作系统Linux, 类Unix, MacOS, Windows
语言英文
类型组态管理, 基础架构即程式码英语Infrastructure as code (IaC), Orchestration engine
许可协议专有软件 / GNU通用公众授权条款
网站www.ansible.com/ 编辑维基数据

Ansible是一套软件工具,其可实现基础架构即程式码英语Infrastructure as code。它是开源的,并且该套件包括软件供应组态管理应用程序部署等功能。 [2]

Ansible 最初由 Michael DeHaan 编写,并于 2015 年被Red Hat收购,其旨在自动化设定类 Unix系统和Microsoft Windows 的环境。Ansible 是无代理英语Software agent的,借由透过SSH或允许PowerShell执行的Windows 远端管理机制来建立临时远端连线。 Ansible 的控制节点在大多数已安装Python的类 Unix 系统上执行,亦包含安装了WSL的 Windows系统。 [3]系统组态英语System configuration部分是透过使用它自己的宣告式语言来定义的。

历史

"ansible"一词是由Ursula K. Le Guin在她 1966 年的小说Rocannon 的世界[4]中所创造的,指的是虚构的即时通讯系统。 [5] [6]

Ansible 工具是由供应服务器应用程序Cobbler的作者与用于远端管理的Fedora 统一网络控制器(Func) 框架其合著者 Michael DeHaan 所开发。 [7]

Ansible, Inc. (原 AnsibleWorks, Inc.) 是由 Michael DeHaan、Timothy Gerla 和 Saïd Ziouani 于 2013 年所创立的公司,旨在为 Ansible 提供商业支持和赞助。 [8] [9] [10] 红帽公司 于2015 年 10 月收购了 Ansible。 [11] [12]

Ansible 被包含在Red Hat所拥有的 Fedora Linux 发行版中,也可透过 Extra Packages for Enterprise (EPEL) 套件用于Red Hat Enterprise LinuxCentOSopenSUSESUSE Linux EnterpriseDebianUbuntuScientific LinuxOracle Linux以及其他作业系统。 [13]

架构

概述

Ansible 借由选择以简单的 ASCII 文字档案来储存的部分 Ansible 存储库来帮助管理多台设备。存储库是可配置的,而目标机器的存储库可以动态取得,也可以从云端服务中不同档案格式 (YAMLINI)的来源中取得。 [14]

从 2014 年以来,敏感资料可以使用 Ansible Vault [15]储存在加密文件中。[16]与其他流行的组态管理软件 (如ChefPuppetSaltCFEngine) 相比,Ansible 使用无代理架构[17]亦即 Ansible 软件无须在控制节点上正常运行,甚至无须安装在控制节点上。[17]Ansible 借由透过 SSH 临时在节点上安装和执行模组来管理节点。在执行一个管理任务期间,执行模组的行程使用基于JSON的协定在其标准输出入界面来与被控制的机器沟通。[18]当 Ansible 不管理节点时,因为没有执行任何后台程式或安装任何软件。 [17],它不会消耗节点上的资源

相依套件

Ansible 要求在所有被管理的机器上安装Python ,包含pip套件管理器、组态管理软件以及其相依套件。受控网络设备不需要额外的相依套件,并且是无代理状态的。 [19]

控制节点

控制节点 (主控主机) 主要是在管理 (协调) 目标机器(称为 "存储库" 的节点,见下文)的运作。 [20]控制节点仅适用于Linux等操作系统,不支援Windows操作系统。其允许多个控制节点。[20] Ansible 不需要单一控制机器来进行协调管理,[21]其确保可用简单的方式来做灾难复原。[21]节点是由控制节点透过SSH来管理。

设计目标

Ansible 的设计目标包括:[18]

  • 本质上为最小。管理系统对环境不应该施加额外的相依套件。 [17]
  • 一致性。使用 Ansible 应该能够建置有一致性的多个环境。
  • 安全。 Ansible 不会布署代理程式到节点,受控节点上只需要OpenSSHPython[17] [21]
  • 可靠的。如果小心地撰写程式,Ansible playbook脚本档案可以是幂等的,以防止对受控系统产生意外的副作用。 [22]然而想要编写非幂等的playbook脚本档案是可以的。
  • 仅需要最少的学习。 Playbook 使用基于YAMLJinja 模板的简单叙述性语言。

模组

模组[23]大多是独立的,可以用标准脚本语言 (如 Python、Perl、Ruby、Bash 等) 来撰写。模组的指导目标之一是幂等性,这意味着即使多次重复操作 (例如从系统错误中复原时),它也会始终将系统置于相同的状态。 [18][需要非第一手来源]

储存库配置

目标节点的位置是透过 (在 Linux 系统上) 位于 /etc/ansible/hosts 的清单配置列表 (INIYAML格式) 来指定。 [14][24]配置文件列出了 Ansible 可访问的每个节点的 IP 地址或主机名称。此外,可以用群组的方式来分配节点。 [14]

以下是一份范例清单 (INI 格式):

192.168.6.1

[webservers]
foo.example.com
bar.example.com

此配置文件指定了三个节点:第一个节点由 IP 地址指定,后两个节点由主机名称来指定。此外,后两个节点被分配给 webservers 群组。

Ansible 还可以使用自定义的动态清单脚本,该脚本可以从不同的系统中动态取得资料,[25]并支援以群组来分配群组。 [26]

Playbook 脚本

Playbook 脚本是内含任务列表的YAML文件,其用于在受控节点上重复[27] [20]执行。 [20] [28]每个 Playbook 都将一组主机映射 (关联) 到一组角色。每个角色都由对 Ansible 任务的呼叫来表示。 [29]

Ansible 自动化平台

Ansible 自动化平台 (Ansible Automation Platform) 是一个REST APIWeb 服务基于 Web 的界面(应用程序),旨在使具有广泛 IT 技能的人更容易使用 Ansible。它是一个由多个组件组成的平台,包括开发人员工具、操作界面以及自动化网络,以实现跨数据中心的大规模自动化任务。 AAP 是 Red Hat, Inc. 支持的商业产品,但衍生了 17 个以上的上游开源项目,包括 AWX 上游项目 (Ansible Tower 衍生自该项目的前身),该项目自 2017 年 9 月开始开源。 [30] [31] [32] [33]

还有另一个 Tower 的开源替代品Semaphore ,它是用Go编写的。 [34] [35]

平台支援

控制机器必须是 Linux/Unix 主机(例如BSDCentOSDebianmacOSRed Hat Enterprise Linux 、 SUSE Linux Enterprise 、 Ubuntu [13],并且需要 Python 2.7 或 3.5。 [19]

托管节点(如果它们是类 Unix)必须具有 Python 2.4 或更高版本。对于使用 Python 2.5 或更早版本的托管节点,还需要python-simplejson套件包。 [36]从 1.7 版本开始,Ansible 还可以管理Windows [37]节点。 [36]在这种情况下,将使用 WS-Management 协议支持的本机 PowerShell 远程处理,而不是 SSH。

Ansible 可以部署到裸机主机、虚拟机和云环境。 [18]

AnsibleFest

AnsibleFest 是让 Ansible 社群用户、贡献者等人参加的年度研讨会。 [38]

地点
2014 加利福尼亚州旧金山
2015 英国伦敦
2016 年 英国伦敦
2016 年 加利福尼亚州旧金山
2016 年 布鲁克林,纽约
2017年 英国伦敦
2017年 旧金山
2018 德克萨斯州奥斯汀
2019 美国佐治亚州亚特兰大
2020 COVID-19 大流行而线上举行
2021 COVID-19 大流行而线上举行
2022 伊利诺伊州芝加哥
2023 波士顿

参见

参考文献

  1. ^ Release 2.16.6. 2024年4月15日 [2024年4月19日]. 
  2. ^ Staff writer. Overview – How Ansible Works. ansible.com. Red Hat, Inc.: 1. [December 7, 2016]. (原始内容存档于2017-12-07). 
  3. ^ Ansible Documentation-Installation Guide. docs.ansible.com. [July 7, 2022]. (原始内容存档于2018-06-24). 
  4. ^ Bernardo, Susan; Murphy, Graham J. Ursula K. Le Guin : a critical companion有限度免费查阅,超限则需付费订阅. Westport, Conn: Greenwood Press. 2006: 18. ISBN 978-0-313-02730-7. OCLC 230345464. 
  5. ^ Frequently Asked Questions. docs.ansible.com. Ansible Documentation. Red Hat, Inc.: 1. [April 30, 2013]. (原始内容存档于2015-07-06). 
  6. ^ DeHaan, Michael. Google Groups Post – Ansible Project. groups.google.com: 1. January 29, 2014 [April 26, 2017]. 
  7. ^ Maughan, Mike. An Interview with Ansible Author Michael DeHaan. coloandcloud.com. Maughansem LLC: 1. April 17, 2012 [November 5, 2012]. (原始内容存档于November 14, 2012). 
  8. ^ About Ansible. Ansible, Inc.: 1. [July 8, 2016]. (原始内容存档于September 5, 2015). 
  9. ^ Bloomberg Research. Ansible, Inc.: Private Company Information. Internet Software and Services. Bloomberg L.P.: 1. [July 8, 2016]. (原始内容存档于2017-09-07). 
  10. ^ About Team. 2015-09-05 [2021-04-07]. (原始内容存档于2015-09-05). 
  11. ^ Novet, Jordan. Source: Red Hat is buying Ansible for more than $100M. venturebeat.com. VentureBeat, Inc.: 1. October 15, 2015 [October 16, 2015]. (原始内容存档于2022-05-21). 
  12. ^ Staff writer. Red Hat to Acquire IT Automation and DevOps Leader Ansible. redhat.com. Red Hat, Inc. October 16, 2015 [October 16, 2015]. (原始内容存档于2021-01-26). 
  13. ^ 13.0 13.1 Ulianytskyi, Mykola. ansible Download (DEB, RPM, TGZ, TXZ, XZ). pkgs.org. Linux Packages Search: 1. [November 5, 2012]. (原始内容存档于2021-08-08). 
  14. ^ 14.0 14.1 14.2 Inventory. docs.ansible.com. Ansible Documentation. Red Hat, Inc.: 1. [April 26, 2014]. (原始内容存档于July 6, 2015). 
  15. ^ Ansible Vault — Ansible Documentation. docs.ansible.com. [2022-09-21]. (原始内容存档于2022-11-17). 
  16. ^ Ansible vault: a framework for encrypting any playbook or var file. · ansible/ansible@427b8dc. GitHub. [2022-09-21]. (原始内容存档于2022-09-22). 
  17. ^ 17.0 17.1 17.2 17.3 17.4 The Benefits of Agentless Architecture (PDF). Red Hat, Inc.: 5. [2022-09-21]. (原始内容存档 (PDF)于2014-05-02). 
  18. ^ 18.0 18.1 18.2 18.3 Ansible in Depth (PDF). Red Hat, Inc.: 5. [2022-09-21]. (原始内容存档 (PDF)于2014-05-02). 
  19. ^ 19.0 19.1 Python 3 Support. docs.ansible.com. Ansible Documentation. Red Hat, Inc.: 1. [July 6, 2017]. (原始内容存档于2017-07-10). 
  20. ^ 20.0 20.1 20.2 20.3 Ansible concepts — Ansible Documentation. docs.ansible.com. [2021-11-19]. (原始内容存档于2022-10-01). "Ansible concepts — Ansible Documentation"页面存档备份,存于互联网档案馆). docs.ansible.com. Retrieved 2021-11-19.
  21. ^ 21.0 21.1 21.2 Installation Guide — Ansible Documentation. docs.ansible.com. [2018-11-30]. (原始内容存档于2018-03-16) (英语). 
  22. ^ Achieving Rolling Updates and Continuous Deployment with Zero Downtime (PDF). Red Hat, Inc.: 7. [2022-09-21]. (原始内容存档 (PDF)于2014-07-27). 
  23. ^ Module Index — Ansible Documentation. docs.ansible.com. [2022-09-21]. (原始内容存档于2022-12-05). 
  24. ^ Working with Inventory — Ansible Documentation. docs.ansible.com. [2018-11-30]. (原始内容存档于2018-03-26) (英语). 
  25. ^ Dynamic Inventory. docs.ansible.com. Ansible Documentation. Red Hat, Inc.: 1. [November 25, 2016]. (原始内容存档于2017-07-11). 
  26. ^ How to build your inventory — Ansible Documentation. docs.ansible.com. [2022-09-21]. (原始内容存档于2022-11-03). 
  27. ^ Playbooks. docs.ansible.com. Ansible Documentation. Red Hat, Inc.: 1. [April 26, 2014]. (原始内容存档于July 6, 2015). 
  28. ^ Intro to playbooks — Ansible Documentation. docs.ansible.com. [2021-11-19]. (原始内容存档于2022-11-11). 
  29. ^ Task And Handler Organization For A Role. docs.ansible.com. Ansible Documentation. Red Hat, Inc.: 1. [November 25, 2016]. (原始内容存档于2017-07-17). 
  30. ^ Redditors. Ansible announces Tower to be Open Source in the near future on AnsibleFest!. reddit.com. Reddit: 1. February 19, 2016 [July 20, 2017]. (原始内容存档于2022-09-22). 
  31. ^ Staff writer. The Open Tower Project. ansible.com/open-tower. Red Hat, Inc.: 1. [January 21, 2017]. (原始内容存档于2017-08-21). 
  32. ^ Hat, Ansible, Red. AWX Project FAQ | Ansible.com. www.ansible.com. [2022-09-21]. (原始内容存档于2018-02-20). 
  33. ^ ansible/awx. March 25, 2020 [2022-09-21]. (原始内容存档于2022-12-21) –通过GitHub. 
  34. ^ Semaphore community. Semaphore API. ansible-semaphore.github.io: 1. [Feb 5, 2021]. (原始内容存档于2016-08-16). 
  35. ^ Semaphore community. ansible-semaphore. github.com/ansible-semaphore. Castaway Consulting LLC. [Feb 5, 2021]. (原始内容存档于2023-01-17). 
  36. ^ 36.0 36.1 Getting started. docs.ansible.com. Ansible Documentation. Red Hat, Inc.: 1. [February 6, 2014]. (原始内容存档于July 6, 2015). 
  37. ^ DeHaan, Michael. Ansible 1.7 is released – Windows beta and more!. ansible.com/blog. The Inside Playbook. Ansible, Inc.: 1. August 6, 2014 [August 7, 2014]. (原始内容存档于2015-09-28). 
  38. ^ AnsibleFest. Ansible. Red Hat, Inc. [October 4, 2018]. (原始内容存档于2022-12-23). 

外部链接