This section collects my Ansible playbooks.

Each one can be run two ways: straight from the CLI, or through AWX (pulled from GitLab) for a production-grade, scalable setup.

Below: how a playbook is laid out, and how to run it both ways.


Project layout

Of course there are thousands project layouts, but here’s the two general ones you can use.

Option A: all-in-one (great for the CLI)

A single self-contained directory with the playbook and its inventory, group_vars and templates together:

my-playbook/
β”œβ”€β”€ ansible.cfg
β”œβ”€β”€ inventory.yml
β”œβ”€β”€ group_vars/
β”‚   └── <group>.yml
β”œβ”€β”€ <playbook>.yml
└── templates/
    └── <something>.j2

Simple and portable: perfect for running from your laptop.

Option B: Inventory/Playbook separated (AWX + GitLab)

Inventory and playbooks live in different GitLab groups/repos: far more scalable for a real environment.

Playbook repo (flat, dependencies at the root):

playbooks/<automation>/         # one repo per automation
β”œβ”€β”€ <playbook>.yml
β”œβ”€β”€ collections/requirements.yml   # external collections
β”œβ”€β”€ roles/requirements.yml         # only if it uses external roles
└── templates/

Inventory repo (hosts + their variables):

inventories/<env>/
└── <type>/
    β”œβ”€β”€ <inventory>.yml             # hosts + groups
    └── group_vars/<group>.yml      # variables for that group

IMPORTANT

collections/requirements.yml (and roles/requirements.yml) must sit at the repo root: AWX installs Galaxy deps only from there, never from subfolders.

Then for wiring everything together (credential, Projects, Inventory Source, Job Template) you can check out how to Connect AWX to GitLab, it pairs with the AWX and GitLab guides.


How to use it

Two ways to run a playbook: from the command line, or via AWX pulled from GitLab (the β€œreal production” approach). Expand the one you need.

1 item under this folder.