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). 

外部連結[编辑]