Have you ever spent hours to configure servers and realize you forgot something simple? I have done this, and it's extremely frustrating! This makes it a perfect time to consider using Ansible and Terraform. These two tools simplify and speed up the server setup and management. I will explain.
Why You Should Automate
Setting servers manually can take a long time and are subject to errors. Ansible and Terraform can easily fix this. Terraform will help you provision servers and networks from code and with a single command, can provision everything. Ansible will automatically configure your servers, such as updating applications and changing default settings.
Have you ever wondered how large hosting companies can provision your server so quickly? They use something similar to this.
Terraform: Plan Your Servers
Terraform is conceptualized as a blueprint for your servers. You will write a small amount of code that says how you expect your servers to look. I enjoy using Terraform because:
• It creates multiple servers of the same exact type, no erroneous versions/mistakes
• You can record changes in code with Git
• You can use with nearly all cloud services, such as AWS, Azure, or Google Cloud.
At one point, I built 10 servers in under 10 minutes with Terraform. By hand, it would take me several hours!
Ansible: Setup Your Servers
After Terraform builds the servers, Ansible takes over. It is a tool to configure your servers and install your software. By using easy YAML files I can:
• Install webservers and databases automatically
• Patch or upgrade software easily
• Automate configuration on several servers at the same time
Ansible does not need any agents or extra software installed on the servers beyond an SSH client. This is why I like it.
Why Use Terraform and Ansible Together
Terraform + Ansible is a great combination. Terraform creates your servers, and Ansible configures them. Using these two will save you a lot of time, mistakes, and make hosting easier.
Conclusion
If you are interest in saving yourself time and mistakes in hosting, I recommend that you learn Terraform and Ansible. Start off small, perhaps with 1 test server just to see how it works, but once you have automated your server setup, you will not want to go back to doing it the manual way. Have you tried it yet? If not, I strongly encourage you to try, you will be glad you did!