There are several IT automations tools like Chef, Puppet, Salt, Rundeck etc. Ansible is one of them and its very popular. Same as other tools, it can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates etc.
Ansible Tower by RedHat is a commercial (free up to 10 Nodes) centralized IT infrastructure control software with a visual dashboard. It includes role-based access control, job scheduling, integrated notifications and graphical inventory management.
Important Ansible Links
Documentation : https://docs.ansible.com/
Galaxy (Official hub for sharing Ansible content) : https://galaxy.ansible.com/
Pinned Repositories : https://github.com/ansible/
Ansible Tower: https://www.ansible.com/products/tower & https://access.redhat.com/products/ansible-tower-red-hat
Core Component of Ansible – Inventories, Modules, Variables, Facts, Plays & Playbooks and Configuration.
1. Inventories
Inventories are how Ansible can locate and run against multiple systems. We can say inventory is a list of hosts. By default, Ansible uses /etc/ansible/hosts as its inventory, but this is configurable. Inventories may be formatted as a INI file or as a YAML file. Note: File formats are interchangeable.
Inventory files may simply consist of a list of hostnames but can be much more robust. It is also possible to define groups of hosts, host or group level variables and groups within the inventory. There are a number of variables that may be used within the inventory to control how ansible connects to and interacts with target hosts.
2. Modules
Modules are essentially tools for particular tasks. It can take parameters and they return JSON and can run from the command line or within a playbook. There are a significant number of modules for many kinds of work. Custom modules can be written
3. Variables
Variables names should be letters, numbers and underscores. Variables should always start with a letter and can be scoped by a group, host or even in a playbook. Typically used for configuration values and various parameters. Variables can also be used to store the return value of executed commands. Ansible variables may also be dictionaries. There are a number of predefined variables used by Ansible
4. Facts
Facts provide certain information about a given target host. Facts are discovered by Ansible automatically when it reaches out to a host. Fact gathering may be disabled. Facts may be cached between playbook executions, but this is not default behaviour.
5. Plays and Playbooks
The goal of a play is to map a group of hosts to some well-defined roles. A play may use one or more modules to achieve a desired end state on a group of hosts. A playbook is a series of plays.
A playbook may deploy new web servers, install a new application to existing application servers and run SQL against some database servers to support the new application
6. Configuration Files
Several Possible locations (In order processed)
- ANSIBLE_CONFIG (an environment variable)
- ansible.cfg (in the current directory)
- .ansible.cfg (in the home directory)
- /etc/ansible/ansible.cfg
Configuration can also be set in environment variables. Some commonly used settings – ansible_managed, forks and inventory
Refer the following link for various playbook examples : https://github.com/cloudwwh/Ansible-Playbooks