# Starter project — Ansible for Proxmox VE workshop

Clone this, and you have a working Ansible project for the workshop lab: the
configuration, the inventory with the three nodes, and a skeleton for every
playbook. **Nothing here does anything to your nodes yet.** The playbooks run
successfully and print what you are supposed to fill in.

Use it if you would rather spend the workshop understanding Ansible than debugging
YAML indentation. Writing the files from scratch works too; the exercise sheets contain
everything either way.

## Get started

The starter project is prepared in `~/ansible-proxmox` (or unpacked from the workshop share):

```bash
cd ~/ansible-proxmox
ansible-playbook playbooks/00-check.yml
```

The last command is complete and should report three reachable Proxmox VE nodes. If
it does, your lab works and everything else is content.

## What is in here

| File | Module | State |
|---|---|---|
| `ansible.cfg` | 01 | complete |
| `inventory/hosts.yml` | 01 | complete, all three nodes and both groups |
| `inventory/group_vars/` | 02, 05 | complete, except the root password |
| `playbooks/00-check.yml` | 00/01 | complete, runs as-is |
| `playbooks/10-node-prep.yml` | 02 | skeleton, task names and order, no content |
| `playbooks/20-cluster.yml` | 03 | skeleton, plays, `serial: 1`, the waits |
| `playbooks/30-operations.yml` | 05 | skeleton |
| `site.yml` + `roles/pve_node/` | 04 | skeleton |
| `inventory/lab.proxmox.yml` | 06 | almost complete, needs the token |

Every unfinished task is an `ansible.builtin.debug` with a `TODO:` message naming the
module and the options you need. Replace the `debug` task with the real one; the
task name and position stay.

Anything that is *structure* rather than *content* is already there: the play layout,
`serial: 1`, `delegate_to`, the `wait_for` tasks, `flush_handlers`, `changed_when`.
Those are the parts that are hard to guess and easy to explain.

## During the workshop

```bash
ansible-playbook playbooks/10-node-prep.yml --check --diff   # dry run first
ansible-playbook playbooks/10-node-prep.yml                  # for real
ansible-playbook playbooks/10-node-prep.yml                  # again -> changed=0
```

In module 03 you set the root password from the trainer in
`inventory/group_vars/pve.yml`, then run:

```bash
ansible-playbook playbooks/20-cluster.yml
```

## If your addresses differ

`inventory/hosts.yml` is the only place to change them. Every playbook, the template
and the `/etc/hosts` generation read the inventory, so one edit is enough.

## This is a lab configuration

`host_key_checking = False` and `validate_certs: false` are shortcuts for lab machines
that are thrown away after the workshop. Do not copy them into production; the handouts
say what to do instead.
