Infrastructure Bundle
Three cheatsheets covering the infrastructure-as-code and provisioning tools every DevOps engineer works with daily: Terraform for declarative infrastructure, Ansible for procedural configuration, and Systemd for the service supervision layer underneath both.
The three tools solve different problems and get used together constantly — this bundle keeps all three within arm's reach.
What's Included
Terraform Cheatsheet
- State management — remote backends, locking,
state mv, import existing resources - Modules — inputs, outputs, versioning, when to abstract vs inline
- Workspaces vs directories — environment separation strategies
- Plan and apply workflow — targeted applies, refresh behaviour, drift detection
- HCL essentials — expressions, for_each vs count, dynamic blocks, locals
- Common pitfalls — provider version pinning, destroy protection, tainting
Ansible Cheatsheet
- Inventory formats — INI, YAML, dynamic inventories, host/group patterns
- Playbook structure — plays, tasks, handlers, tags, serial rolls
- Variables and facts — precedence order, registered results,
whenconditions - Templates — Jinja2 filters, lookups, vault integration
- Ad-hoc commands — one-liners for fleet-wide checks
- Roles and collections — structure, galaxy, requirements.yml
Systemd Cheatsheet
- Unit files — service, timer, socket, path activation
- systemctl operations — enable vs disable, mask, isolate, edit overrides
- journalctl queries — filtering by unit, boot, priority, time window
- Timers — OnCalendar syntax, Persistent=true, timer vs cron decision
- Resource control — CPU/memory limits, sandboxing directives
- Troubleshooting — status codes, restart policies, cgroup inspection
Excerpt — Terraform State Handling
State is the most dangerous file in your repository. The sheet covers the safe patterns:
# Never edit state by hand — use targeted moves
terraform state mv aws_instance.old aws_instance.new
# Import an existing resource into management
terraform import aws_instance.web i-0abc123def456
# Check for drift without applying changes
terraform plan -detailed-exitcode
# exit 0 = no changes, 1 = error, 2 = changes present
Excerpt — Systemd Timer vs Cron
# /etc/systemd/system/backup.timer
[Unit]
Description=Nightly backup
[Timer]
OnCalendar=*-*-* 02:30:00
Persistent=true # catch up after downtime — cron can't do this
[Install]
WantedBy=timers.target
Persistent=true is the reason to prefer timers over cron on any machine that reboots: a missed run during downtime executes once the machine is back, instead of silently skipping.
Dividing Work Between Terraform and Ansible
| Layer | Tool | Why | |---|---|---| | Cloud resources (VMs, networks, buckets) | Terraform | Declarative, drift-detectable, provider-managed | | On-host configuration (packages, configs) | Ansible | Procedural, idempotent over SSH | | Service supervision | Systemd | The layer both tools end up writing unit files for |
The classic boundary: Terraform creates the server, Ansible configures it, Systemd keeps the service running. The bundle's sheets cross-reference each other at these boundaries.
Related Reading on graphwiz.ai
Format
- Three PDFs (print-ready, A4)
- Instant download after purchase
Price
$14.00
Who This Is For
- Infrastructure engineers automating server provisioning and configuration management
- DevOps practitioners migrating from manual SSH workflows to Infrastructure as Code
- Platform teams who need a quick reference for Terraform HCL, Ansible playbooks, and Systemd unit files in one place
FAQ
OpenTofu or Terraform?
The syntax is identical for everything in the sheet. Where the registries or CLI names differ (tofu vs terraform), the sheet notes both.
Does the Ansible sheet cover Ansible Navigator and execution environments?
It covers the classic ansible-playbook CLI plus a section on ansible-navigator for containerized execution environments, since most new deployments standardize on the latter.
Are the cheatsheets updated? Yes — buyers get re-download access to new revisions through the library page.