How I Built This Blog with Terraform and Ansible on Azure

Welcome to Ingram Cloud Lab! I’m Marilyn, an MIS student at Georgia College, and this blog is where I document what I’m learning about cloud infrastructure, starting with the blog itself.

Why I built it

In one of my Linux courses, I set up a LAMP server on AWS by hand: installing Apache, MySQL, and PHP, then creating separate users and permissions for three client websites. It worked, but it was slow and easy to get wrong. I kept thinking: what if I needed fifty servers?

That question led me to infrastructure as code, where servers, networks, and firewalls are described in files instead of set up by clicking. I’d taken courses on Terraform and Ansible, but I wanted to use them on something real. So I built the server this blog runs on.

What’s running this site

  • Terraform builds everything in Azure: a resource group, a virtual network and subnet, a firewall that only allows SSH from my IP, and two Ubuntu servers. Terraform’s state file is stored remotely in Azure Storage.
  • Ansible configures the servers. One runs MySQL. The other runs Apache, PHP, and WordPress, and connects to the database over the private network.
  • GitHub Actions checks every change I make, with format checks, a linter, and a security scan, before it’s merged.

How a change gets from my laptop to Azure

  1. I change the code on a new Git branch.
  2. I open a pull request on GitHub, and the CI pipeline checks it automatically.
  3. Once the checks pass, I merge it.
  4. terraform apply builds or updates the infrastructure.
  5. ansible-playbook configures the servers.

Right now I run the last two steps from my laptop. Connecting them to GitHub so they run automatically after I approve a change is my next project.

A note on how I wrote the code

I used AI to help generate the starting code, then I ran every piece myself and worked through every error. Honestly, that’s where most of the learning happened. I hit five different Azure errors on the first day, and I wrote about all of them in my next post.

What I learned

Terraform builds the house. Ansible furnishes it. Knowing which tool does which job made infrastructure as code finally make sense to me.

The code for this whole site is public on GitHub: github.com/Marilyn-Ingram/homelab