What is Ansible
Ansible can be thought of as a multi-purpose tool for:
AnnouncementI have released my new course on Udemy, Kubernetes By Example. Sign up now to get free lifetime access!
- Cloud Infrastructure Automation – You can use it to build new virtual machines on popular cloud platforms, such as AWS and Azure. Another very popular tool that’s used for this kind of work is Terraform
- Configuration Management of Linux/Windows machines – You can use it to configure Linux and Windows Machines. This means Ansible is used to install software, update config files, and start services.
- Deployment tool – It can be used to deploy new versions of in-house developed software to your server
Ansible has a controller-client type architecture, where you have one main (aka the controller) managing lots of other machines (aka clients). Ansible is an agentless architecture which means that you only need to install Ansible on the Controller.
The Controller uses SSH/WinRM to communicate with all the clients.
Advantages of Ansible
- Easy to read syntax – All the code is written in YAML syntax
- It is a multi-purpose tool – it can do provisioning, environment orchestration, configuration management tool, deployment tool
- You don’t need to install or configure anything on the clients. The clients needs to have ssh, and a relatively recent version of python
- Ansible pushed based – clients don’t need to have any services running to periodically do an ansible run. Instead you trigger the run from the controller.
- Scalable – Easy to build multiple controllers, the clients are not configured to communicate with a particular controller. Hence when number of clients goes up to thousands, then you can quickly build new controllers to handle
- can execute adhoc shell commands on the clients
- Huge library of available modules – These modules behaves idempotently to bring a ensure a stage.
Disadvantages of Ansible
- Abstractions are kept to a minimum – e.g. for installing packages on RHEL based OS, you need to use the yum’s built-in module, whereas for Ubuntu, you use apt’s built-in module instead
- Individual Ansible runs can be a little slow – This becomes apparent when compared to other tools such as