Infrastructure as Code

Two sanitized IaC samples

Small, self-contained modules that show how I actually write infrastructure code — an Ansible server-hardening role and an OpenTofu AWS VPC module — sanitized of any employer or home-network specifics and readable start to finish.

Staged samples, kept here on purpose. These live inside the site for now rather than as their own public repositories, matching the rest of the site's staged posture — preview only, not indexed. Each folder is a complete, standalone project (its own README, license, tests, and CI) and can be lifted out into its own public repo unchanged. Nothing here contains a real IP, hostname, credential, or account ID.
Browse any file below · each is served raw from this site.

Why these exist

The Selected Work section claims AWS network configuration under OpenTofu and standardized Linux hosts under Ansible. That's the kind of claim that's easy to write and hard to believe without something to read. These two samples answer the obvious follow-up — how deep is the IaC really? — by being the code, not a description of it.

They're deliberately small. Each does one job, does it idempotently, and is written to be understood in one sitting rather than to impress with size. Both are tested and both run their own linting and CI, because "it's in version control" and "it actually works" are different claims.

ansible-linux-baseline

Ansible role · Debian / Ubuntu · MIT

An opinionated, incrementally-adoptable security baseline for a fresh Debian or Ubuntu server. Point it at a box that just finished its OS install and it brings the host to a known-good state: admin users with SSH keys, a hardened SSH daemon, sane network/kernel sysctl settings, automatic security updates, and a persistent, size-capped journal.

The problem it solves. Every new server starts the same way — password SSH on, root login allowed, no non-root admins, nothing patching itself, logs gone on reboot. Fixing that by hand is easy to get almost right and easy to do slightly differently each time; that drift is what bites six months later. This turns "the way we set up a server" into one reviewable, re-runnable definition.

Design choices worth knowing:

Tested with Molecule against a Docker container: converge applies the role, verify asserts the outcomes (hardened sshd -T output, the admin user in its group, live sysctls, unattended-upgrades present, persistent journald). CI runs yamllint, ansible-lint, and the full Molecule suite.

ansible-linux-baseline/ ├─ README.md # problem, usage, config table ├─ requirements.yml ├─ defaults/main.yml # every variable, documented ├─ handlers/main.yml ├─ meta/main.yml ├─ tasks/ │ ├─ main.yml # asserts distro, imports the rest │ ├─ packages.yml │ ├─ users.yml │ ├─ ssh.yml # lockout-guarded hardening │ ├─ sysctl.yml │ ├─ updates.yml │ └─ journald.yml ├─ templates/ │ ├─ sshd_hardening.conf.j2 │ ├─ 52unattended-upgrades-local.j2 │ └─ journald.conf.j2 ├─ examples/playbook.yml ├─ molecule/default/ converge.yml · verify.yml · molecule.yml └─ .github/workflows/ci.yml · .ansible-lint · .yamllint · LICENSE

opentofu-aws-vpc

OpenTofu / Terraform module · AWS · MIT

A small, readable AWS VPC module: a VPC with public and private subnets spread across availability zones, an internet gateway for public egress, and optional NAT gateway(s) for private egress. It does one job well — it's the module you'd actually read before running it, not a forty-variable framework.

The problem it solves. Almost every AWS environment starts with the same networking boilerplate, and hand-written it's a few hundred lines that are easy to get subtly wrong: a missing route-table association, a NAT gateway in the wrong subnet, public subnets that don't actually assign public IPs. This encodes that layout once, correct by construction, so a new environment is a dozen lines of inputs instead of a page of resources to copy-paste and mis-edit.

Design choices worth knowing:

Tested in CI with tofu fmt -check, tofu validate on both the root module and the runnable example, and tflint — none of which needs AWS credentials.

opentofu-aws-vpc/ ├─ README.md # problem, usage, inputs/outputs ├─ versions.tf # required_version + providers ├─ variables.tf # inputs with validation ├─ main.tf # vpc, subnets, igw, nat, routes ├─ locals.tf ├─ outputs.tf ├─ examples/simple/ main.tf · variables.tf └─ .github/workflows/ci.yml · .tflint.hcl · LICENSE