Traditionally, infrastructure has been managed manually. At best, there would be a user interface which could assist in creating and configuring compute instances. For most of the users who begin their journey with a cloud, a web-based dashboard is the first and most convenient way to interact. However, such a manual method is error prone. Some of the most commonly faced problems are:
Requirement for more personnel to manage infrastructure round the clock
Probability of errors and inconsistencies due to human involvement
Lack of repeatability and auditability
Creating Infrastructure as Code addresses these concerns and helps in more than one way. A well maintained code base will allow us to refer to the infrastructure state, not only at the present but also at various points in the past.
Ansible helps us code various aspects of infrastructure including provisioning, configuring, and eventually, retiring. Ansible supports coding over 20 cloud providers and self-managed infrastructure setups. Due to its open nature, existing providers can be enhanced and customized and new providers can be added easily.
Once we start managing Infrastructure as Code, we open ourselves to the possibility of a lot of automation. While this book focuses on creating and managing the infrastructure, the possibilities are limitless. We can:
Raise an alarm if a critical machine becomes unreachable.
Personnel who do not have access to infrastructure can still help by coding the infrastructure. A code review exercise could help to enforce best practices.
We can scale infrastructure dynamically based on our requirements.
In case of a disaster, we can create replacements quickly.
Passing knowledge of best practices within and outside the organization becomes easier.
Throughout this book, we will create our infrastructure from Ansible code and demonstrate its usability and repeatability.