Ansible is one of several tools that can be used for configuration management, this post provides some notes on the various roles that Ansible can perform as well as how it works. For an introduction to Puppet, take a look at my post – “Puppet – Introduction“.
So, what is Ansible – what does it do? It can take care of:
- Change Management
Define the system state i.e. what the system is meant to look like.
Ansible can be used to enforce the system state. For example, a web server may have the following definition:
- Apache web installed
- Apache web at version x.x.xx
- Apache web started
If Ansible detects that system has changed then a “change event” is triggered to:
- put the system back (to the defined state)
- mark the system as changed
The next step is to determine why the system has changed.
Ansible employs idempotence – the function executed is idempotent if the system state remains the same after repeated applications as it was after a single application.
Systems can be prepared and made ready for use taking them from one state to another.
This process is different from cloning a virtual machine as Ansible installs and configures fresh each time. The following steps may be typical in taking a fresh server from just having the OS installed to being a functional web server:
- Install web server software
- Copy configuration files
- Copy website files
- Install security updates
- Start the web service
Firstly, define the tasks to be executed automatically, they should be ordered the tasks should make decisions. The tasks could be ad-hoc but they may still be suitable for automation.
It should be possible to set and forgot the tasks once configured for automation.
Automation is on just one system but orchestration co-ordinates the automation across multiple systems such as:
- Web servers
- Load balancers
- Database servers
This is handled by the Ansible Control Server.
Part 2 will touch on reasons to use Ansible and a few of it’s characteristics with subsequent posts covering architecture and how to create a test Ansible environment.