At the end of Module 10 you took stock: you have gone through the whole automation cycle with Ansible, from the first ping to event-driven remediation, but each piece was built lesson by lesson and many of them were left marked as pending. This final module is your integration project: you are going to take Aurora Store to production the way a real operations team would. And as in any real project, you don't start by writing YAML but by designing: what has to be achieved, with which requirements, which architecture satisfies them, what you already have, what is missing, which decisions you make (and why) and how you will know you are done. In this lesson you will write that design: the project brief, the functional and non-functional requirements, the target production architecture, the map of what is built versus what is pending, the design decisions as short records (ADRs), the final repository layout, a phased work plan with milestones and the acceptance criteria. The implementation comes in the next lesson; here you will only write the code needed to pin down the design.

Contents

  1. How to work through this project
  2. The brief
  3. Functional requirements
  4. Non-functional requirements
  5. The target architecture
  6. The main flows
  7. What is already built
  8. What is missing: the map of pending items
  9. Design decisions (ADRs)
  10. Final repository layout
  11. Work plan: phases and milestones
  12. Acceptance criteria

  1. How to work through this project

This project is meant to be done on your own, without an instructor. So that you don't get lost:

  • Previous lessons are not repeated. When a piece relies on something you have already learned, you will see the reference (for example, "Lesson 7.5, workflows"). If you don't remember it, go back to that lesson before continuing.
  • The design lives in the repository. Everything you write in this lesson (requirements, ADRs, plan) goes into aurora-infra/docs/, versioned alongside the code. A design that only exists in your head or in a chat gets lost.
  • Work in phases and on branches. Each phase of the plan (section 11) is a branch with its own pull request, a green CI and its CHANGELOG.md entry, just as you have done since Module 9.
  • Always verify the same way. After every change: ansible-lint and yamllint (Lesson 9.4), ansible-playbook playbooks/site.yml --check --diff against the lab (it must finish with no unexpected changes) and, at the end of each phase, the acceptance criteria that apply to it (section 12).
  • Watch the cost. The only resource you pay for is staging on AWS. Always destroy it when you finish working (the design itself automates this, ADR-07).

Set up the documentation structure:

cd ~/aurora-infra
git switch main && git pull
git switch -c final-project-design
mkdir -p docs/adr docs/runbooks
  • docs/design.md: the design document (brief, requirements, architecture, plan, criteria). You will fill it in with sections 2 to 12.
  • docs/adr/: one file per design decision (section 9).
  • docs/runbooks/: the deployment and rollback procedures, which you will write in the next lesson.

  1. The brief

Project: Aurora Store in production. Aurora Store's management wants to stop treating its infrastructure as a lab. As the DevOps lead, you must deliver a platform in which:

  1. every configuration change or new website version is first tested in a staging environment structurally identical to production, validated with automated tests, approved by someone from Operations and rolled out to production without interrupting the service;
  2. the database has daily backups that are monitored and tested;
  3. the servers and the store are monitored, with alerts, and known incidents fix themselves, leaving a trace in AWX;
  4. everything can be rebuilt from the repository, with pinned versions and supported tools;
  5. anyone on the team can deploy and roll back a deployment by following a written procedure.

The project deliverables:

Deliverable Where Lesson
Design document docs/design.md 11.1
Decision records docs/adr/0001-...md to 0013-...md 11.1
Code for the pending pieces aurora-infra (roles, playbooks, inventories, Terraform, EE, CI) 11.2
Documented AWX objects docs/awx.md (table of objects and permissions) 11.2
Deployment and rollback runbooks docs/runbooks/ 11.2
Completed self-assessment checklist docs/acceptance.md 11.2
A version released end to end Website 1.5.0 in production, promoted from staging 11.2

  1. Functional requirements

Functional requirements state what the platform must do. Each one has an identifier so it can be cited in the acceptance criteria.

Id Requirement Hints about what you already have
FR-01 Configure any environment (lab, staging, production) from a single entry point: playbooks/site.yml Lesson 9.1
FR-02 Create and destroy staging on AWS from AWX, without depending on anyone's laptop Lessons 8.5, 10.2
FR-03 Promote a website version: staging → smoke tests → approval → production, with a rolling deployment Lessons 5.7, 7.5, 8.3
FR-04 Launch the promotion from a web-X.Y.Z tag in Git Lesson 8.3
FR-05 Run read-only smoke tests against any environment, on demand and on a schedule New
FR-06 Take a daily backup of the PostgreSQL databases and their roles New
FR-07 Regularly test that the latest backup can be restored New
FR-08 Collect metrics from all servers, from the catalog API and from the backups Lesson 6.2 (agent)
FR-09 Raise alerts: server down, catalog API down, disk almost full, backup too old New
FR-10 Automatically remediate an outage of a web server and of the catalog API, running the fix in AWX Lesson 10.5
FR-11 Notify the team of the outcome of each run (webhook) Lesson 10.3

  1. Non-functional requirements

Non-functional requirements state how well it must be done. They are what separates a demo from a production platform, and they are what drives most design decisions.

4.1. Availability

Id Requirement How it is measured
NFR-A1 Deploy the website with zero downtime: at every moment at least one web server serves the store A curl loop against the load balancer during the deployment: no errors
NFR-A2 Detect a web server or the API being down in under 2 minutes Timestamp of the event versus the timestamp of the outage
NFR-A3 Automatically remediate those outages in under 5 minutes Remediation job in AWX with status Successful
NFR-A4 RPO (maximum data loss) of 24 hours for the database Daily backup + an alert if the latest successful one is more than 26 hours old
NFR-A5 RTO (maximum recovery time) of 4 hours to restore the database A timed restore test following the runbook

Accepted single points of failure. The load balancer (lb1), the database (db1) and the platform itself (awx1, mon1) are single instances. For Aurora Store this is an accepted, documented risk (ADR-01); high availability for those pieces (a redundant load balancer, a PostgreSQL replica) is left as an extension.

4.2. Security

Id Requirement
NFR-S1 No plaintext secrets in Git: passwords and tokens in Vault (one identity per environment) or in AWX credentials
NFR-S2 Least privilege for every service account: gitea-ci (launch), eda (remediations only), a read-only AWS credential for the inventory
NFR-S3 New ports are opened only to whoever needs them: the metrics agent (9100) only to Prometheus; Prometheus and Alertmanager only locally; the Alertmanager event source is not published outside its network
NFR-S4 Everything hardened in Lesson 9.2 stays in place (SSH, sudo, known_hosts, server_tokens off, deployment account in Kubernetes)
NFR-S5 Supported tools: no piece on a version that is out of security support (ansible-core 2.17 is, Lesson 9.4)

Warning. The security measures in this project are appropriate for a case study. Before taking a design like this to a real company, have it reviewed by a security specialist and adapt the controls to your obligations (data protection, payments, audits).

4.3. Traceability

Id Requirement
NFR-T1 Every change comes in through Git: commit, reviewed pull request, green CI, CHANGELOG.md
NFR-T2 Every run against staging or production goes through AWX: who, what, when, with which revision and with what result
NFR-T3 Approvals are recorded (AWX approval node)
NFR-T4 Automatic remediations show up in AWX as regular jobs, not just in a process log
NFR-T5 Every relevant design decision is written down (ADR)

4.4. Reproducibility

Id Requirement
NFR-R1 staging can be created from scratch with a single button (the workflow) and ends up structurally identical to production
NFR-R2 Pinned versions for everything: collections, roles, images, ansible-core, CI tools, Terraform providers
NFR-R3 The execution environment (EE) is the only way to run in AWX, with immutable tags
NFR-R4 The Terraform state is shared and locked (it does not live on a laptop)
NFR-R5 A fresh clone of the repository + the secrets handed over separately are enough to operate (Lesson 6.3)

4.5. Cost and maintainability

  • staging exists only while it is in use: the workflow creates it and a nightly schedule destroys it.
  • Whatever is not automated in this project (installing awx1, configuring AWX) is documented and recorded as debt, with its proposed extension (section 8).

  1. The target architecture

flowchart TB
    subgraph Team["Operations and Development team"]
        DEV["Laptop<br/>aurora-infra, ansible-lint, Molecule"]
    end

    subgraph Platform["awx1 (192.168.56.30): platform"]
        GIT["Gitea<br/>ops/aurora-infra"]
        CI["Gitea Actions<br/>act_runner"]
        REG["Registry<br/>aurora-ee 2.0.0, aurora-de 1.0.0"]
        AWX["AWX<br/>templates, workflow, RBAC"]
        K3S["k3s: catalog API<br/>namespace aurora"]
    end

    subgraph Monitoring["mon1 (192.168.56.51): monitoring and events"]
        PROM["Prometheus"]
        AM["Alertmanager"]
        EDA["ansible-rulebook<br/>(decision environment)"]
    end

    subgraph Production["Production (the lab, ADR-01)"]
        LB["lb1: nginx load balancer"]
        W1["web1"]
        W2["web2"]
        DB["db1: PostgreSQL<br/>+ daily backups"]
        API["api1: catalog API<br/>Docker Compose"]
    end

    subgraph AWS["AWS eu-south-2: ephemeral staging"]
        SW["web x2"]
        SD["db x1"]
        S3["S3: Terraform state<br/>use_lockfile"]
    end

    DEV -- "push / PR / web-X.Y.Z tag" --> GIT
    GIT --> CI
    CI -- "builds" --> REG
    CI -- "launches (awx CLI)" --> AWX
    AWX -- "EE images" --> REG
    AWX -- "OpenTofu + site.yml" --> AWS
    AWX -- "site.yml / webservers.yml (serial 1)" --> Production
    LB --> W1
    LB --> W2
    W1 --> DB
    W2 --> DB
    PROM -- "scrape :9100" --> Production
    PROM --> AM
    AM -- "webhook (internal Compose network)" --> EDA
    EDA -- "url_check" --> W1
    EDA -- "url_check" --> W2
    EDA -- "run_job_template" --> AWX

Component by component:

Component Where Role Status
lb1 Lab / production nginx load balancer (nginx role 1.1.0 in upstream mode) Built (5.7)
web1, web2 Lab / production nginx + the store website (aurora_app) Built (Mod. 3–5)
db1 Lab / production PostgreSQL 16 (postgresql) Built; backups missing
api1 Lab / production Catalog API + Redis in Docker Compose Built (8.1); its health metric is missing
k3s aurora awx1 Catalog API on Kubernetes (kubernetes.yml) Built (8.2); outside the scope of the promotion
mon1 Lab / production Prometheus, Alertmanager, ansible-rulebook New
AWX awx1 Execution, credentials, RBAC, workflows, schedules Built (Mod. 7); staging, promotion and remediations missing
Gitea + Actions awx1 Code, CI, release tags Built (8.3, 9.4)
Registry awx1 aurora-ee, aurora-catalog and, new, aurora-de images Built (7.6), without TLS (debt)
staging AWS Structural replica of production (web ×2, db ×1), ephemeral Built (8.5, 10.2); needs to be moved to AWX
Terraform state S3 Shared, locked state New

Note two deliberate simplifications in staging: it has no load balancer and no catalog API. Staging reproduces what the promotion changes (website and database) at minimum cost; the loadbalancers, apiservers and the new monitorservers groups exist but are empty so that the playbooks work the same way (the convention from Lesson 9.1).

  1. The main flows

6.1. Promoting a website version

sequenceDiagram
    actor Dev as Development (laura)
    actor Ops as Operations (marc)
    participant G as Gitea + CI
    participant A as AWX
    participant S as staging (AWS)
    participant P as Production

    Dev->>G: PR: aurora_app_version "1.5.0" in lab, staging and production
    G->>G: CI (lint, syntax, Molecule)
    Ops->>G: Reviews and merges into main
    Dev->>G: git tag -a web-1.5.0 + push
    G->>A: web-deploy.yml launches "Aurora - Release web version"
    A->>A: Sync the project
    A->>S: Staging infrastructure (OpenTofu, state in S3)
    A->>A: Sync the "Aurora - Staging" inventory (aws_ec2)
    A->>S: Configure staging (full site.yml)
    A->>S: Smoke tests
    A->>Ops: Approval "Approve promotion to production"
    Ops->>A: Approves
    A->>P: Deploy web (serial 1, out of and back into the load balancer)
    A->>P: Smoke tests

6.2. From an alert to a remediation

sequenceDiagram
    participant API as api1 (health timer)
    participant NE as node_exporter
    participant PR as Prometheus (mon1)
    participant AM as Alertmanager (mon1)
    participant EDA as ansible-rulebook (mon1)
    participant AWX as AWX
    API->>NE: aurora_catalog_up 0 (.prom file)
    PR->>NE: scrape every 15 s
    PR->>PR: AuroraCatalogDown rule (for: 1m)
    PR->>AM: firing alert, instance=api1
    AM->>EDA: webhook http://eda:5050/
    EDA->>EDA: rule + 15 min throttle
    EDA->>AWX: run_job_template "Aurora - Remediate catalog"
    AWX->>API: remediate-catalog.yml (checks, restarts, verifies)

  1. What is already built

Before planning what is missing, take stock of what you have. The table summarizes the state of aurora-infra at the end of Module 10, grouped by capability:

Capability Pieces Lessons
Per-environment inventories inventories/{lab,staging,production}, per-environment root groups, aurora_internal_ip 9.1
Server configuration Roles common (with SSH/sudo hardening), postgresql, aurora_app, docker, aurora_catalog, aurora_catalog_k8s; nginx 1.1.0 from Gitea; geerlingguy.node_exporter 2.2.0 Mod. 4–6, 8, 9.2
Templates and handlers All configuration in .j2 with ansible_managed, validate and handlers 5.1, 5.2
Zero-downtime deployment webservers.yml with serial: 1, max_fail_percentage: 0 and the nginx_upstream_server module 5.7, 10.1
Secrets Vault with the lab, staging and production identities; no_log 5.4, 9.1, 9.2
Shared content Role and collection requirements.yml; the aurora_store.infra 1.2.0 collection Mod. 6, 10.1, 10.3
Platform AWX 24.6.1 on k3s: templates, workflow with approval, RBAC, nightly schedule Mod. 7
Execution environment aurora-ee 1.4.0 (built by the CI), ansible-navigator 7.6, 8.3, 10.3
Containers and Kubernetes Catalog API on api1 (Compose) and on k3s; Traefik with Helm 8.1, 8.2
CI/CD Gitea Actions: lint, syntax, Molecule, nightly check, EE on changes, release via web-X.Y.Z tag 8.3, 9.4, 9.5
Cloud staging on AWS with OpenTofu run from Ansible and the aws_ec2 dynamic inventory 8.4, 8.5, 10.2
Quality yamllint, ansible-lint (production profile), pre-commit, Molecule for common 9.4, 9.5
Performance Pipelining, ControlPersist, fact caching, free strategy in upgrade.yml 9.3
Extensions Module, filter, test, lookup and summary callback in aurora_store.infra 10.1, 10.3
Automation from code tools/update.py (ansible-runner), tools/awx_launch.py (API) 10.4
Events rulebooks/watch-store.yml, remediate-web.yml, remediate-catalog.yml (with run_playbook, on the laptop) 10.5

And a quick check, so you start the project from a known state:

cd ~/aurora-infra
source .venv/bin/activate
ansible-lint && yamllint --strict .                    # quality
ansible-playbook playbooks/site.yml --check --diff     # the lab has no drift
curl -s http://192.168.56.10/ | grep -o 'Version [0-9.]*'   # Version 1.4.0

If --check shows changes, investigate them before you start: don't build a project on top of a state you don't understand.

  1. What is missing: the map of pending items

Throughout the course, many lessons ended with "this will be solved in the final project". This table gathers them all, with their origin, the decision you make now and their priority. Core means it is part of the project and of its acceptance criteria; extension means it is documented as debt and proposed as later work (Lesson 11.2, extension ideas).

# Pending item Origin Decision Priority Phase
P01 Upgrade ansible-core to a supported series (collections, EE, CI tools) 9.4, 10.1 ansible-core 2.20; aurora-ee 2.0.0 Core 1
P02 PostgreSQL backups 5.8 postgresql_backup role (pg_dump + timer) and restore test (ADR-06) Core 2
P03 Prometheus; open 9100 only to Prometheus 6.2, 9.2 mon1 with Prometheus in a container; node_exporter on the internal IP + ufw (ADR-02, ADR-04) Core 3
P04 Alertmanager with the AuroraCatalogDown alert (instance = inventory name) 10.5 Health metric through the textfile collector (ADR-03) Core 3
P05 Alertmanager → EDA, with the source open only to Alertmanager 10.5 Internal Compose network on mon1 (ADR-05) Core 4
P06 Where ansible-rulebook lives; switch to run_job_template 10.5 aurora-de container on mon1; remediation templates in AWX (ADR-05) Core 4
P07 The summary callback webhook as an AWX credential 10.3 Aurora - Notifications (webhook) credential type (ADR-12) Core 4
P08 Remote Terraform state (S3 + use_lockfile), tofu in the EE 8.5 Bucket created by Ansible, partial backend (ADR-09) Core 5
P09 staging in AWX: inventory from the project with a read-only AWS credential, staging Vault credential 9.1, 10.2 Aurora - Staging inventory; infrastructure, sync and configuration as separate steps (ADR-08) Core 5
P10 Production in AWX: production Vault credential, inventory 9.1 Aurora - Production inventory created; in the project, the lab acts as production (ADR-01) Core 5
P11 staging → approval → production workflow 7.5, 9.1 Redesign of Aurora - Release web version (ADR-07, ADR-11) Core 6
P12 Scheduled smoke (integration) tests in staging 9.5 playbooks/smoke-tests.yml, in the workflow and every hour in production Core 6
P13 Automate awx1 (Gitea, registry, runner) 7.2, 8.3 The existing manual procedure is documented Extension —
P14 Image registry with TLS and authentication 7.2, 9.2 Debt documented in README.md Extension —
P15 CI runner in its own container or VM 8.3, 9.2 Documented debt Extension —
P16 AWX configuration as code (awx.awx) 7.1, 10.4 Documented in docs/awx.md (ADR-13) Extension —
P17 A CI of its own for the collection (ansible-test) and publishing aurora_catalog_info 10.1, 10.3 Out of scope Extension —
P18 A copy of the backups outside db1 New (ADR-06) Debt with a deadline: before real customer data Extension —
P19 kubernetes.yml and the catalog API on k3s in the promotion 8.2 Out of scope (the promotion is about the website) Extension —

Notice the criterion for deciding what is core: it is everything needed to meet the requirements in sections 3 and 4. The rest improves the platform but does not block it. That classification is itself a design decision, which is why it is written down.

  1. Design decisions (ADRs)

An ADR (Architecture Decision Record) is a short document that captures one decision: the context, what was decided, the alternatives that were discarded and the consequences. Its value shows up months later, when someone asks "why is this like this?" and the answer is in the repository, not in the memory of someone who has left.

Template for docs/adr/NNNN-short-title.md:

# ADR-NNNN: Title phrased as a decision

- Status: accepted (proposed | accepted | superseded by ADR-XXXX)
- Date: 2026-11-26

## Context
What the problem is and which constraints shape it.

## Decision
What is done, in one or two clear sentences.

## Alternatives considered
- Alternative A: why not.
- Alternative B: why not.

## Consequences
What is gained, what is lost, what debt remains and how it will be reviewed.

The project's decisions, in summary form (write each one in its own file using the template):

ADR-01. The lab acts as production. Context: the production inventory (Lesson 9.1) is a "paper" inventory: its IPs don't exist. Decision: in the project, the production nodes of the workflow use the Aurora - Lab inventory and its credentials; the Aurora - Production inventory and its credentials are created anyway, and moving to real production means changing the inventory and credentials of those nodes. Alternatives: create a production environment on AWS (permanent cost, no added teaching value); have no production at all (the project would lose its purpose). Consequences: the lab's single points of failure (a single load balancer and a single database) are accepted and documented.

ADR-02. Prometheus and Alertmanager in containers on a new server, mon1. Context: monitoring is needed and it cannot live on a server it monitors (if db1 goes down, the alert must still arrive). Decision: a mon1 VM (192.168.56.51, monitorservers group) with the docker and aurora_monitoring (new) roles, which deploys the official images with Docker Compose, the same pattern as the catalog API (Lesson 8.1). Alternatives: the prometheus.prometheus collection with binaries and systemd (another third-party piece to evaluate; valid, Lesson 6.1); on k3s (it would mix monitoring with the platform it has to watch); on awx1 (no free memory and the same problem). Consequences: it reuses the docker role; mon1 is a single point of failure for monitoring (accepted; watching the monitoring itself is left as an extension).

ADR-03. Application and backup metrics through the textfile collector. Context: the catalog API only listens on 127.0.0.1 (Lesson 9.2) and backups have no port to query. Decision: small scripts on the server itself write .prom files into the node_exporter textfile collector directory (aurora_catalog_up, aurora_postgresql_backup_last_success_timestamp_seconds). The instance label of each server will be its inventory name, set in the Prometheus configuration. Alternatives: blackbox_exporter (it would require opening the API or deploying another agent); exposing the API (contradicts Lesson 9.2). Consequences: no new ports; if the script stops running, the metric goes stale (watched through the file's age).

ADR-04. node_exporter on the internal IP, reachable only from Prometheus. Decision: node_exporter_host changes from 127.0.0.1 to aurora_internal_ip in the environments that have a monitoring server, and a ufw rule allows 9100 only from the Prometheus IP. Consequences: on db1, api1 and mon1, ufw is not active (Lesson 3.3): the rule is written but does not filter. This is accepted in the lab; in real production, security groups or the network firewall play that role. Enabling ufw on every server is left as an extension.

ADR-05. ansible-rulebook in a container on mon1, with run_job_template. Context: in Lesson 10.5, ansible-rulebook ran in a terminal and executed playbooks with the laptop's keys. Decision: a decision environment aurora-de:1.0.0 (built with ansible-builder, like the EE) runs as the eda service in the same Compose project as Alertmanager. Alertmanager sends it the alerts over the internal Compose network (http://eda:5050/), without publishing the port. The actions are run_job_template against the Aurora - Remediate web and Aurora - Remediate catalog templates, with the AWX user eda (only Execute on them). Alternatives: run_playbook (SSH and Vault keys on mon1); EDA controller (doesn't fit in the lab). Consequences: mon1 only stores an AWX token (encrypted with Vault in the repository); every remediation is recorded in the AWX history.

ADR-06. Logical backups with pg_dump and a systemd timer on db1, with a restore test. Context: RPO of 24 h and RTO of 4 h. Decision: a postgresql_backup role: pg_dumpall --globals-only + pg_dump --format=custom per database, every night with a systemd timer, retention by days, a success metric; a test-restore.yml playbook that restores the latest backup into a temporary database and compares it with the original. Alternatives: scheduling it in AWX (if AWX goes down, there are no backups: the backup must not depend on the platform); physical backups with pg_basebackup + WAL (they allow point-in-time recovery, but are more complex: an extension for when the RPO drops). Consequences: the backups are kept on the same server: they protect against logical errors (an accidental DROP), not against losing db1. The off-site copy (P18) is debt with a deadline.

ADR-07. Ephemeral staging, created by the workflow and destroyed every night. Decision: the promotion workflow creates or updates staging; an AWX schedule destroys it at 21:00. Consequences: every promotion also tests that the environment can be created from scratch (NFR-R1); the cost is limited to the hours of use; the first promotion of the day takes longer (about 10 minutes of provisioning).

ADR-08. Infrastructure, inventory sync and configuration as separate steps in AWX. Context: on the laptop, staging-provision.yml applies Terraform and then meta: refresh_inventory discovers the new instances. In AWX, the job receives the inventory from the AWX database; it does not run the aws_ec2 plugin: refresh_inventory would discover nothing. Decision: split the playbook into staging-infra.yml (Terraform) and staging-configure.yml (wait + site.yml); staging-provision.yml imports both so it can still be used from the laptop. In the workflow, an inventory source sync node goes between the two. Consequences: the same code works on the laptop and in AWX.

ADR-09. Terraform state in S3 with use_lockfile. Decision: an aurora-tfstate-<suffix> bucket (versioned, encrypted, no public access) created by an Ansible playbook (terraform-state.yml), and an s3 backend with partial configuration: the Terraform code declares backend "s3" {} and the values come from Ansible through backend_config. Alternatives: DynamoDB for locking (the classic mechanism, replaced by the S3 lockfile in OpenTofu 1.10 and Terraform 1.10); state in Gitea or in an HTTP backend (less standard). Consequences: the bucket has a single owner (Ansible), and Terraform never manages it (the rule from Lesson 8.5).

ADR-10. ansible-core 2.20 and aurora-ee 2.0.0 first. Context: ansible-core 2.17 is out of support. Decision: upgrade to the 2.20 series (the ansible 13 package) before building anything new, so you don't have to migrate twice. The EE moves to major version 2.0.0 because the ansible-core series changes and tofu is added. Consequences: the 2.19 series introduced significant changes to the templating engine and to conditionals; phase 1 includes reading the porting guides and running all the tests.

ADR-11. The website version lives in each environment's inventory and is promoted by tag. Decision: the pull request for a version changes aurora_app_version in inventories/{lab,staging,production}/group_vars/webservers.yml; the CI checks that the web-X.Y.Z tag matches all three. Alternative: a single common variable (simpler, but a full run in production would deploy the version before it went through staging). Consequences: three lines to change for every version; in exchange, each environment declares what it has deployed.

ADR-12. AWX operational secrets as credentials. Decision: the notification webhook URL is stored in a custom credential type (Aurora - Notifications (webhook), which injects AURORA_SUMMARY_WEBHOOK); the AWX token used by EDA goes in the environment vault (vault_aurora_eda_awx_token), because Ansible deploys it to mon1.

ADR-13. AWX is configured through the UI, documented in docs/awx.md. Context: NFR-R5 requires being able to rebuild everything. Decision: in this project, the AWX objects are created by hand and documented in a table (name, type, fields, permissions). Consequences: this is the main reproducibility debt; configuration as code with the awx.awx collection is the first proposed extension (P16).

  1. Final repository layout

This is what aurora-infra will look like at the end of the project. The marks show what is new (N) and what changes (C) compared with Module 10:

aurora-infra/
├── README.md, CHANGELOG.md                         (C: final project sections)
├── ansible.cfg                                     (unchanged)
├── ansible-navigator.yml                           (C: aurora-ee:2.0.0)
├── docs/                                           (N)
│   ├── design.md                                   (N: this design)
│   ├── awx.md                                      (N: AWX objects and permissions)
│   ├── acceptance.md                               (N: completed checklist)
│   ├── adr/0001-lab-as-production.md ... 0013-awx-via-ui.md   (N)
│   └── runbooks/{deployment.md, rollback.md}       (N)
├── inventories/
│   ├── lab/
│   │   ├── hosts.yml                               (C: monitorservers[mon1])
│   │   └── group_vars/{dbservers.yml (C: retention), webservers.yml (C: 1.5.0), monitorservers.yml (N)}
│   ├── staging/
│   │   ├── aws_ec2.yml, hosts.yml                  (C: empty monitorservers)
│   │   └── group_vars/{dbservers.yml (C), webservers.yml (C: 1.5.0)}
│   └── production/
│       ├── hosts.yml                               (C: monitorservers[prod-mon1])
│       └── group_vars/{dbservers.yml (C), webservers.yml (C: 1.5.0), monitorservers.yml (N)}
├── playbooks/
│   ├── site.yml                                    (C: + monitorservers.yml at the end)
│   ├── monitorservers.yml                          (N)
│   ├── monitoring.yml                              (C: ufw rule for Prometheus)
│   ├── dbservers.yml                               (C: + postgresql_backup role)
│   ├── smoke-tests.yml, test-restore.yml           (N)
│   ├── terraform-state.yml                         (N)
│   ├── staging-infra.yml, staging-configure.yml    (N: ADR-08)
│   ├── staging-provision.yml                       (C: imports the previous two)
│   ├── remediate-web.yml                           (C: compares with aurora_internal_ip)
│   ├── group_vars/
│   │   ├── all/monitoring.yml                      (C: internal IP, textfile)
│   │   ├── dbservers.yml, apiservers.yml           (C: wiring for backups and metrics)
│   │   ├── monitorservers.yml                      (N)
│   │   └── {lab,staging,production}/vault.yml      (C: + vault_aurora_eda_awx_token)
│   └── vars/aws-staging.yml                        (C: state bucket)
├── roles/
│   ├── postgresql_backup/                          (N)
│   ├── aurora_monitoring/                          (N)
│   ├── aurora_catalog/                             (C: optional health metric)
│   └── common/, postgresql/, aurora_app/, docker/, aurora_catalog_k8s/
├── collections/requirements.yml                    (C: versions for ansible-core 2.20)
├── terraform/staging/versions.tf                   (C: partial backend "s3")
├── ssh/
│   ├── known_hosts.lab                             (C: + mon1)
│   └── aurora_staging_ed25519.pub                  (N: staging PUBLIC key)
├── ee/execution-environment.yml                    (C: 2.0.0, Python 3.12, ansible-core 2.20, tofu)
├── eda/decision-environment.yml                    (N: aurora-de 1.0.0)
├── rulebooks/                                      (C: requirements for ansible-core 2.20)
├── ci/requirements.txt                             (C: new versions)
├── .gitea/workflows/{ci.yml, ee.yml, de.yml (N), web-deploy.yml (C)}
└── lab/Vagrantfile                                 (C: + mon1)

Outside the repository, AWX also changes (credentials, inventories, templates, workflow, schedules, the eda user), as do the registry (the aurora-ee:2.0.0 and aurora-de:1.0.0 images), AWS (the state bucket, IAM permissions) and your laptop (pipx with the new Ansible series). Gitea needs no changes: releases still come in through protected web-* tags (Lesson 8.3).

  1. Work plan: phases and milestones

The order of the phases is no accident: each one builds on the previous one and ends with a verifiable milestone. If a phase fails, the following ones don't start.

flowchart LR
    F0["Phase 0<br/>Design and starting point"] --> F1["Phase 1<br/>ansible-core 2.20<br/>aurora-ee 2.0.0"]
    F1 --> F2["Phase 2<br/>Backups"]
    F1 --> F3["Phase 3<br/>Monitoring"]
    F2 --> F3
    F3 --> F4["Phase 4<br/>Events and remediation in AWX"]
    F1 --> F5["Phase 5<br/>staging in AWX<br/>remote state"]
    F4 --> F6["Phase 6<br/>Promotion and smoke tests"]
    F5 --> F6
    F6 --> F7["Phase 7<br/>Acceptance and closure"]
Phase Content Branch Milestone (when it is finished)
0 Design (this lesson), ADRs, check of the starting point final-project-design M0: docs/ merged; site.yml --check with no changes
1 ansible-core 2.20, collections, CI tools, aurora-ee 2.0.0 with tofu ansible-core-2.20 M1: green CI with 2.20; lab changed=0; AWX using aurora-ee 2.0.0
2 postgresql_backup role, test-restore.yml backups M2: nightly backup created and successfully restored
3 mon1, node_exporter open to Prometheus, API metric, aurora_monitoring role monitoring M3: all targets up in Prometheus; test alert visible in Alertmanager
4 aurora-de, EDA on mon1, remediation templates, eda user, webhook credential awx-events M4: stopping the API on api1 produces a successful Aurora - Remediate catalog job in AWX
5 S3 bucket and backend, splitting the staging playbooks, staging and production credentials and inventories in AWX staging-awx M5: staging created, configured and destroyed from AWX
6 smoke-tests.yml, promotion workflow, release CI, runbooks promotion M6: website 1.5.0 released end to end with the web-1.5.0 tag
7 Acceptance checklist, documentation, CHANGELOG.md project-closure M7: all the criteria in section 12 checked

A rough estimate for doing it at your own pace: phases 1 and 3 are the longest (one or two work sessions each); the rest take one session. What takes the most time is not writing the code but verifying: don't skip the milestones.

  1. Acceptance criteria

The project is finished when all these criteria are met and you have left the evidence in docs/acceptance.md (one line per criterion: date, how you checked it and the link to the AWX job or the CI run). The next lesson ends with the complete checklist, including the commands to verify them.

Id Criterion Requirements
AC-01 ansible-lint (production profile), yamllint --strict and Molecule pass in the CI with ansible-core 2.20 NFR-R2, NFR-S5
AC-02 site.yml --check --diff against the lab finishes with no changes after applying the whole project FR-01
AC-03 All AWX templates use aurora-ee 2.0.0 NFR-R3
AC-04 There is a backup of each database from the last 24 h and test-restore.yml finishes successfully FR-06, FR-07, NFR-A4
AC-05 Prometheus scrapes the agent on every server in the environment, with instance equal to the inventory name FR-08
AC-06 Port 9100 on web1 does not respond from your laptop but does from mon1 NFR-S3
AC-07 The four alerts are defined and the old-backup one fires if the timer is stopped for more than 26 h (or this is simulated) FR-09
AC-08 Stopping nginx on a web server or the API container produces a successful remediation job in AWX in under 5 minutes FR-10, NFR-A2, NFR-A3, NFR-T4
AC-09 No new plaintext secret in Git (gitleaks in pre-commit and ci/check-vault.sh green) NFR-S1
AC-10 The Terraform state is in S3 and two simultaneous runs cannot modify it at the same time NFR-R4
AC-11 staging is created, configured and destroyed from AWX without using the laptop FR-02, NFR-R1
AC-12 The AWS credential of the staging inventory is read-only (it cannot create instances) NFR-S2
AC-13 Website 1.5.0 reaches production with the web-1.5.0 tag, going through staging, smoke tests and marc's approval, with no errors in a curl loop against the load balancer FR-03, FR-04, NFR-A1, NFR-T3
AC-14 The smoke tests run every hour against production FR-05
AC-15 Every run sends a notification through the webhook without its URL being in the repository FR-11
AC-16 The deployment and rollback runbooks exist and the website rollback has been rehearsed at least once NFR-A5
AC-17 The 13 ADRs and docs/awx.md are written and merged NFR-T5, ADR-13
AC-18 staging is destroyed at the end (no resources being billed) 4.5

Save the design:

git add docs/
git commit -m "Final project: design document, ADRs and work plan"
git push -u origin final-project-design

Open the pull request and merge it once the CI is green: that is milestone M0.

Common Mistakes and Tips

  • Starting to code without a design. It is the usual temptation, and the reason half of all projects end up with pieces that don't fit (for example, discovering in phase 5 that refresh_inventory doesn't work in AWX, after you have already built the workflow on top of staging-provision.yml). ADR-08 exists because someone thought about it beforehand.
  • Requirements that can't be measured. "The store must always be available" is not a requirement: you would never know when you meet it. Always write down how it is measured (the tables in section 4).
  • Confusing core with extension. If everything is a priority, nothing is. When in doubt, ask: "without this, is any requirement not met?". If the answer is no, it is an extension.
  • ADRs that are too long. Nobody reads a five-page ADR. One page at most; if you need more, it is probably two decisions.
  • Not writing down the discarded options. The "Alternatives" section prevents someone, six months from now, from proposing with every apparent reason what was already discarded for a reason nobody remembers.
  • Hiding the debt. Backups on the same server or the manual AWX configuration are not design flaws if they are written down, with their risk and their plan. What is serious is nobody knowing about them.
  • Skipping the starting point. If the lab has drift before you begin, every phase will show you changes that aren't yours and you won't be able to tell them apart.
  • Tip: draw the diagrams with Mermaid inside docs/design.md. Gitea renders them directly and they are versioned like the rest of the code.

Exercises

Exercise 1: failure analysis

For each of these components, state what happens if it goes down, how you find out and what mitigates it in the design: lb1, web2, db1, mon1, awx1.

Exercise 2: a complete ADR

Write the complete ADR-06 (backups) using the template from section 9, including a third alternative that doesn't appear in the summary: scheduling the backups with an AWX schedule that launches a playbook with community.postgresql.postgresql_db and state: dump.

Exercise 3: classifying a new pending item

During the design review, Operations asks for two more things: "a Grafana dashboard with the metrics" and "automatic renewal of the store's TLS certificate". Classify each one as core or extension using the criterion from section 8 and justify it. For the one that is an extension, suggest which phase it would fit into if it became core.

Solutions

Exercise 1.

Component What happens How you find out What mitigates it
lb1 The store doesn't respond (single point of failure) AuroraServerDown alert (if the machine goes down); the hourly smoke tests fail Nothing automatic: risk accepted in ADR-01. Extension: a second load balancer with a floating IP (for example, keepalived)
web2 The load balancer keeps serving with web1 (nginx marks the server as unavailable after the failures) EDA (url_check) in under 1 minute; an alert if the machine goes down Automatic remediation if it is nginx; if it is the VM, human intervention
db1 The store serves pages, but whatever uses the database fails AuroraServerDown; smoke tests (wait_for on port 5432) Deliberately not remediated automatically (Exercise 3 of Lesson 10.5); daily backups for recovery
mon1 There are no alerts or remediations: the failure is silent Only if someone watches the watcher The hourly AWX smoke tests (which notify through the webhook) cover part of it. Extension: an external check of mon1
awx1 No deployments, promotions or remediations (EDA can't launch templates); the store keeps working EDA logs errors when launching; the CI fails when contacting AWX Backups don't depend on AWX (ADR-06); emergency procedure with ansible-playbook from the laptop in the runbook

The important conclusion is the mon1 row: a monitoring system itself needs to be watched by something independent. It is a classic design case.

Exercise 2. An example of docs/adr/0006-postgresql-backups.md:

# ADR-0006: Logical PostgreSQL backups with pg_dump and a systemd timer

- Status: accepted
- Date: 2026-11-26

## Context
Aurora Store has no backups of its database. The requirements are an RPO of
24 hours and an RTO of 4 hours (NFR-A4, NFR-A5). The database is small
(less than 1 GB) and lives on a single server, db1.

## Decision
A postgresql_backup role installs a script that runs pg_dumpall --globals-only and
pg_dump --format=custom for each database, launched every night by a systemd timer
on db1, with retention by days and a success metric for Prometheus.
A test-restore.yml playbook restores the latest backup into a temporary
database and compares it with the original.

## Alternatives considered
- Scheduling the backups from AWX with postgresql_db and state: dump: if AWX is not
  available, there are no backups; besides, the dump would still end up where the
  module runs (db1), with no location advantage.
- Physical backups with pg_basebackup and WAL archiving: they allow recovery to any
  point in time (an RPO of minutes), but require more storage, more configuration and
  more restore practice. To be reviewed if the RPO drops below 24 hours.
- VM disk snapshots: they depend on the hypervisor and don't guarantee database
  consistency without stopping it.

## Consequences
- Backups don't depend on AWX or on the network.
- Backups stay on db1: they protect against logical errors, not against losing the server.
  Debt P18: an off-site copy before storing real customer data.
- The custom format allows restoring individual tables with pg_restore.
- Review: when the database exceeds 10 GB or the RPO drops.

Exercise 3. Grafana: extension. No requirement asks for a dashboard: the alerts (FR-09) and querying Prometheus directly cover detection; a dashboard improves investigation, but its absence doesn't break any requirement. If it became core, it would fit into phase 3 (another service in the aurora_monitoring Compose project). Automatic TLS certificate renewal: today the store serves HTTP in the lab, so no requirement demands it and it is an extension; but in a real store with payments it would be core, no question (an expired certificate is a total outage), and it would force you to add a new requirement (for example, NFR-S6: "the store is only served over HTTPS with a valid certificate") before touching the plan. Notice the reasoning: the classification depends on the requirements, and if a pending item seems essential but no requirement asks for it, what is missing is the requirement.

Conclusion

You have designed the final project the way a professional team would: a brief with deliverables, measurable functional and non-functional requirements (availability, security, traceability, reproducibility), a target architecture with mon1 as the new monitoring and events server, the promotion and remediation flows, an inventory of what already works, the map of every pending item accumulated during the course classified as core or extension, thirteen design decisions written as ADRs, the final repository layout, a phased plan with verifiable milestones and eighteen acceptance criteria. The most valuable thing is not any particular file but the habit: decide before you build, write down why and know in advance how you will check that you are done. With the design merged into main (milestone M0), in the next lesson, Final Project: Implementation, Testing and Continuous Deployment, you will go through the phases one by one: you will upgrade ansible-core, add the backups, set up Prometheus and Alertmanager connected to Event-Driven Ansible, bring staging and production into AWX with a promotion workflow and release version 1.5.0 of the website end to end.

Ansible Course: From Beginner to Advanced

Module 1: Introduction to Ansible

Module 2: Ansible Fundamentals

Module 3: Playbooks

Module 4: Roles

Module 5: Advanced Playbook Techniques

Module 6: Ansible Galaxy

Module 7: Ansible Tower, AWX and Automation Platform

Module 8: Ansible for DevOps

Module 9: Ansible Best Practices

Module 10: Advanced Ansible Topics

Module 11: Final Project

© Copyright 2026. All rights reserved