Software:Ansible

From HandWiki
Short description: Open-source software platform for remote configuring and managing computers
Ansible
Ansible logo.svg
Original author(s)Michael DeHaan
Developer(s)Ansible Community / Ansible Inc. / Red Hat Inc.
Written inPython, PowerShell, Shell
Operating systemLinux, Unix-like, MacOS, Windows
Available inEnglish
TypeConfiguration management, infrastructure as code (IaC), Orchestration engine
LicenseGNU General Public License version 3

Ansible is a suite of software tools that enables infrastructure as code. It is open-source and the suite includes software provisioning, configuration management, and application deployment functionality.[1]

Originally written by Michael DeHaan in 2012, and acquired by Red Hat in 2015, Ansible is designed to configure both Unix-like systems and Microsoft Windows. Ansible is agentless, relying on temporary remote connections via SSH or Windows Remote Management which allows PowerShell execution. The Ansible control node runs on most Unix-like systems that are able to run Python, including Windows with Windows Subsystem for Linux installed.[2] System configuration is defined in part by using its own declarative language.

History

The term "ansible" was coined by Ursula K. Le Guin in her 1966 novel Rocannon's World,[3] and refers to fictional instantaneous communication systems.[4][5]

The Ansible tool was developed by Michael DeHaan, the author of the provisioning server application Cobbler and co-author of the Fedora Unified Network Controller (Func) framework for remote administration.[6]

Ansible, Inc. (originally AnsibleWorks, Inc.) was the company founded in 2013 by DeHaan, Timothy Gerla, and Saïd Ziouani to commercially support and sponsor Ansible.[7][8][9] Red Hat acquired Ansible in October 2015.[10][11]

Ansible is included as part of the Fedora distribution of Linux, owned by Red Hat, and is also available for Red Hat Enterprise Linux, CentOS, openSUSE, SUSE Linux Enterprise, Debian, Ubuntu, Scientific Linux, and Oracle Linux via Extra Packages for Enterprise Linux, as well as for other operating systems.[12]

<timeline>

ImageSize = width:900 height:340 PlotArea = right:30 left:30 bottom:60 top:30 DateFormat = dd/mm/yyyy Period = from:01/01/2017 till:01/01/2023 TimeAxis = orientation:horizontal Legend = orientation:vertical position:bottom columns:2 Colors =

    id:production value:green            Legend:Production
    id:extended   value:rgb(0.9,0.9,0.2) Legend:Extended_support
    id:lightline  value:rgb(0.8,0.8,0.8)

BackgroundColors = canvas:white ScaleMajor = gridcolor:lightline unit:year increment:1 start:01/01/2017

Define $vshift = 15 # move text above the bars

PlotData=

 bar:          
   color:production mark:(line,white) align:left fontsize:M
   from:30/11/2021 till:01/01/2023 shift:(-55,-4) text:"Ansible 5.0.0"
   barset:break
     color:production
     from:21/12/2021 till:01/01/2023 shift:(-13,$vshift) text:"5.1.0"
 bar:         
   color:production mark:(line,white) align:left fontsize:M
   from:18/05/2021 till:30/11/2021 shift:(-55,-4) text:"Ansible 4.0.0"
   barset:break
     color:production
     from:08/06/2021 till:30/11/2021 shift:(-13,$vshift) text:"4.1.0"
 bar:        
   color:production mark:(line,white) align:left fontsize:M
   from:16/02/2021 till:18/05/2021 shift:(-55,-4) text:"Ansible 3.0.0"
   barset:break
     color:production
     from:09/03/2021 till:18/05/2021 shift:(-13,$vshift) text:"3.1.0"
 bar:       
   color:production mark:(line,white) align:left fontsize:M
   from:22/09/2020 till:01/05/2022 shift:(-55,-4) text:"Ansible 2.10.0"
 bar:      
   color:production mark:(line,white) align:left fontsize:M
   from:31/10/2019 till:02/10/2021 shift:(-55,-4) text:"Ansible 2.9.0"
 bar:     
   color:production mark:(line,white) align:left fontsize:M
   from:16/05/2019 till:15/09/2019 shift:(-55,-4) text:"Ansible 2.8.0"
   barset:break
     color:production
     from:07/06/2019 till:04/07/2019 shift:(-13,$vshift) text:".1"
 bar:    
   color:production mark:(line,white) align:left fontsize:M
   from:04/10/2018 till:31/12/2018 shift:(-55,-4) text:"Ansible 2.7.0"
   barset:break
     color:production
     from:04/10/2018 till:16/05/2019 shift:(-13,$vshift) text:".0"
   barset:break
     color:production
     from:04/10/2018 till:16/05/2019 shift:(-13,$vshift) text:".1"
 bar:   
   color:production mark:(line,white) align:left fontsize:M
   from:02/07/2018 till:04/10/2018 shift:(-55,-4) text:"Ansible 2.6.0"
 bar:  
   color:production mark:(line,white) align:left fontsize:M
   from:23/03/2018 till:02/07/2018 shift:(-55,-4) text:"Ansible 2.5.0"
 bar: 
   color:production mark:(line,white) align:left fontsize:M
   from:18/09/2017 till:23/03/2018 shift:(-62,-4) text:"Ansible 2.4.0"

TextData =

  pos:(275,355)
  fontsize:L
  textcolor:black
  text:"Ansible timeline"

</timeline>

Architecture

Overview

Ansible helps to manage multiple machines by selecting portions of Ansible's inventory stored in simple plain text files. The inventory is configurable, and target machine inventory can be sourced dynamically or from cloud-based sources in different formats (YAML, INI).[13]

Sensitive data can be stored in encrypted files using Ansible Vault[14] since 2014.[15] In contrast with other popular configuration-management software — such as Chef, Puppet, Salt and CFEngine — Ansible uses an agentless architecture,[16] with Ansible software not normally running or even installed on the controlled node.[16] Instead, Ansible orchestrates a node by installing and running modules on the node temporarily via SSH. For the duration of an orchestration task, a process running the module communicates with the controlling machine with a JSON-based protocol via its standard input and output.[17] When Ansible is not managing a node, it does not consume resources on the node because no daemons are run or software installed.[16]

Dependencies

Ansible requires Python to be installed on all managing machines, including pip package manager along with configuration-management software and its dependent packages. Managed network devices require no extra dependencies and are agentless.[18]

Control node

The control node (master host) is intended to manage (orchestrate) target machines (nodes termed as "inventory", see below).[19] Control nodes can be run from Linux and Unix-like operating systems (including MacOS); Windows OSs are only supported through the Windows Subsystem for Linux.[20] Multiple control nodes are allowed.[19] Ansible does not require a single controlling machine for orchestration,[21] ensuring that disaster recovery is simple.[21] Nodes are managed by the controlling node over SSH.

Design goals

The design goals of Ansible include:[17]

  • Minimal in nature. Management systems should not impose additional dependencies on the environment.[16]
  • Consistent. With Ansible, one should be able to create consistent environments.
  • Secure. Ansible does not deploy agents to nodes. Only OpenSSH and Python are required on the managed nodes.[16][21]
  • Reliable. When carefully written, an Ansible playbook can be idempotent, to prevent unexpected side effects on the managed systems.[22] It is possible to write playbooks that are not idempotent.
  • Minimal learning required. Playbooks use an easy and descriptive language based on YAML and Jinja templates.

Modules

Inventory configuration

Location of target nodes is specified through inventory configuration lists (INI or YAML formatted) located at /etc/ansible/hosts (on Linux).[13][23] The configuration file lists either the IP address or hostname of each node that is accessible by Ansible. In addition, nodes can be assigned to groups.[13]

An example inventory format (INI file):

192.168.6.1

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

This configuration file specifies three nodes: the first node is specified by an IP address, and the latter two nodes are specified by hostnames. Additionally, the latter two nodes are grouped under the webservers group.

Ansible can also use a custom Dynamic Inventory script, which can dynamically pull data from a different system,[24] and supports groups of groups.[25]

Playbooks

Playbooks are YAML files that store lists of tasks for repeated[26][19] executions on managed nodes.[19][27] Each Playbook maps (associates) a group of hosts to a set of roles. Each role is represented by calls to Ansible tasks.[28]

Ansible Automation Platform

The Ansible Automation Platform (AAP) is a REST API, web service, and web-based interface (application) designed to make Ansible more accessible to people with a wide range of IT skillsets. It is a platform composed of multiple components including developer tooling, an operations interface, as well as an Automation Mesh to enable automation tasks at scale across data centers. AAP is a commercial product supported by Red Hat, Inc. but derived 17+ upstream open source projects including the AWX upstream project (formerly Ansible Tower derived from), which has been open source since September 2017.[29][30][31][32]

There also is another open source alternative to Tower, Semaphore, written in Go.[33][34]

Platform support

Control machines have to be a Linux/Unix host (for example BSD, CentOS, Debian, macOS, Red Hat Enterprise Linux, SUSE Linux Enterprise, Ubuntu[12]), and Python 2.7 or 3.5 is required.[18]

Managed nodes, if they are Unix-like, must have Python 2.4 or later. For managed nodes with Python 2.5 or earlier, the python-simplejson package is also required.[35] Since version 1.7, Ansible can also manage Windows[36] nodes.[35] In this case, native PowerShell remoting supported by the WS-Management protocol is used instead of SSH.

Ansible can deploy to bare metal hosts, virtual machines, and cloud environments.[17]

AnsibleFest

AnsibleFest is an annual conference of the Ansible community of users, contributors, etc.[37]

Year Location
2014 San Francisco, California, US
2015 London, UK
2016 London, UK
2016 San Francisco, California, US
2016 Brooklyn, New York, US
2017 London, UK
2017 San Francisco, California, US
2018 Austin, Texas, US
2019 Atlanta, Georgia, US
2020 Virtual only due to COVID-19 pandemic
2021 Virtual only due to COVID-19 pandemic
2022 Chicago, Illinois, US
2023 Boston, Massachusetts, US

See also

References

  1. Staff writer. "Overview – How Ansible Works". Red Hat, Inc.. pp. 1. https://www.ansible.com/how-ansible-works. 
  2. "Ansible Documentation-Installation Guide". https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#control-node-requirements. 
  3. Bernardo, Susan; Murphy, Graham J (2006). Ursula K. Le Guin : a critical companion. Westport, Conn: Greenwood Press. p. 18. ISBN 978-0-313-02730-7. OCLC 230345464. https://archive.org/details/ursulakleguincri00bern. 
  4. "Frequently Asked Questions". Red Hat, Inc.. pp. 1. https://docs.ansible.com/ansible/latest/reference_appendices/faq.html. 
  5. DeHaan, Michael (January 29, 2014). "Google Groups Post – Ansible Project". pp. 1. https://groups.google.com/d/msg/ansible-project/djZklLE2wIE/XCEOIq0RbN4J. 
  6. Maughan, Mike (April 17, 2012). "An Interview with Ansible Author Michael DeHaan". Maughansem LLC. pp. 1. http://www.coloandcloud.com/editorial/an-interview-with-ansible-author-michael-dehaan. 
  7. "About Ansible". Ansible, Inc.. pp. 1. http://www.ansible.com. 
  8. Bloomberg Research. "Ansible, Inc.: Private Company Information". Internet Software and Services. Bloomberg L.P.. pp. 1. https://www.bloomberg.com/research/stocks/private/snapshot.asp?privcapId=233465248. 
  9. "About Team". 2015-09-05. http://www.ansible.com/about-team. 
  10. Novet, Jordan (October 15, 2015). "Source: Red Hat is buying Ansible for more than $100M". VentureBeat, Inc.. pp. 1. https://venturebeat.com/2015/10/15/source-red-hat-is-buying-ansible-for-more-than-100m/. 
  11. Staff writer (October 16, 2015). "Red Hat to Acquire IT Automation and DevOps Leader Ansible". redhat.com. Red Hat, Inc.. http://www.redhat.com/en/about/press-releases/red-hat-acquire-it-automation-and-devops-leader-ansible. 
  12. 12.0 12.1 Ulianytskyi, Mykola. "ansible Download (DEB, RPM, TGZ, TXZ, XZ)". Linux Packages Search. pp. 1. https://pkgs.org/download/ansible. 
  13. 13.0 13.1 13.2 "Inventory". Red Hat, Inc.. pp. 1. https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html. 
  14. "Ansible Vault — Ansible Documentation". https://docs.ansible.com/ansible/latest/user_guide/vault.html. 
  15. "Ansible vault: a framework for encrypting any playbook or var file. · ansible/ansible@427b8dc". https://github.com/ansible/ansible/commit/427b8dc78de43aa02be968bbbcb2f10ed487fe1e. 
  16. 16.0 16.1 16.2 16.3 16.4 "The Benefits of Agentless Architecture" (PDF). Red Hat, Inc.. pp. 5. http://cdn2.hubspot.net/hub/330046/file-479013288-pdf/pdf_content/The_Benefits_of_Agentless_Architecture.pdf?t=1390852839000. 
  17. 17.0 17.1 17.2 "Ansible in Depth" (PDF). Red Hat, Inc.. pp. 5. http://cdn2.hubspot.net/hub/330046/file-480366556-pdf/pdf_content/Ansible_in_Depth.pdf?t=1390852822000. 
  18. 18.0 18.1 "Python 3 Support". Red Hat, Inc.. pp. 1. http://docs.ansible.com/ansible/python_3_support.html. 
  19. 19.0 19.1 19.2 19.3 "Ansible concepts — Ansible Documentation". https://docs.ansible.com/ansible/latest/user_guide/basic_concepts.html. 
  20. "Installing Ansible". https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html. 
  21. 21.0 21.1 21.2 "Installation Guide — Ansible Documentation" (in en). http://docs.ansible.com/ansible/latest/intro_installation.html#managed-node-requirements. 
  22. "Achieving Rolling Updates and Continuous Deployment with Zero Downtime". Red Hat, Inc.. pp. 7. http://cdn2.hubspot.net/hub/330046/file-479069823-pdf/pdf_content/Achieving_Rolling_Updates_and_Continuous_Deployment_with_Zero_Downtime.pdf. 
  23. "Working with Inventory — Ansible Documentation" (in en). http://docs.ansible.com/ansible/latest/intro_inventory.html. 
  24. "Dynamic Inventory". Red Hat, Inc.. pp. 1. http://docs.ansible.com/ansible/intro_dynamic_inventory.html. 
  25. "How to build your inventory — Ansible Documentation". https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html. 
  26. "Playbooks". Red Hat, Inc.. pp. 1. https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_intro.html. 
  27. "Intro to playbooks — Ansible Documentation". https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#about-playbooks. 
  28. "Task And Handler Organization For A Role". Red Hat, Inc.. pp. 1. http://docs.ansible.com/ansible/playbooks_best_practices.html#task-and-handler-organization-for-a-role. 
  29. Redditors (February 19, 2016). "Ansible announces Tower to be Open Source in the near future on AnsibleFest!". Reddit. pp. 1. https://www.reddit.com/r/ansible/comments/46juz4/ansible_announces_tower_to_be_open_source_in_the/. 
  30. Staff writer. "The Open Tower Project". Red Hat, Inc.. pp. 1. https://www.ansible.com/open-tower. 
  31. Hat, Ansible, Red. "AWX Project FAQ | Ansible.com". https://www.ansible.com/products/awx-project/faq. 
  32. "ansible/awx". March 25, 2020. https://github.com/ansible/awx. 
  33. Semaphore community. "Semaphore API". pp. 1. https://www.ansible-semaphore.com/api-docs/. 
  34. Semaphore community. "ansible-semaphore". Castaway Consulting LLC. https://github.com/ansible-semaphore/semaphore. 
  35. 35.0 35.1 "Getting started". Red Hat, Inc.. pp. 1. https://docs.ansible.com/ansible/latest/getting_started/index.html. 
  36. DeHaan, Michael (August 6, 2014). "Ansible 1.7 is released – Windows beta and more!". Ansible, Inc.. pp. 1. http://www.ansible.com/blog/ansible-1.7-is-released-windows-beta-and-more. 
  37. "AnsibleFest". Red Hat, Inc.. https://www.ansible.com/ansiblefest. 

External links