54 lines
2.6 KiB
Markdown
54 lines
2.6 KiB
Markdown
# 03 - Running the Playbooks
|
|
|
|
All commands assume you are inside the DevContainer, working from the `ansible/` directory.
|
|
|
|
## Step 1 — Verify Connectivity
|
|
|
|
```bash
|
|
ansible all -i inventories/<customer>/hosts.ini -m ping
|
|
```
|
|
|
|
All nodes should return `pong`. If any fail with `Permission denied`, run `ssh-copy-id root@<ip>` for that node and retry.
|
|
|
|
## Step 2 — (Optional) Configure the P2P Private Network
|
|
|
|
If you have dedicated NICs for Corosync and DRBD replication and have set `priv_nic_1`, `priv_nic_2`, and `priv_ip` in `hosts.ini`, run `network.yml` first to configure the `p2p` bridge on all nodes:
|
|
|
|
```bash
|
|
ansible-playbook network.yml -i inventories/<customer>/hosts.ini
|
|
```
|
|
|
|
This writes the bridge stanza into `/etc/network/interfaces` and applies it live with `ifreload -a` — no reboot required. The task is skipped on any node that does not have `priv_nic_1` and `priv_nic_2` defined.
|
|
|
|
## Step 3 — Dry Run
|
|
|
|
Preview all changes before applying anything. Declarative tasks (file writes, package installs, sysctl, templates) are fully simulated and shown with diffs. Shell tasks (Linstor registrations, `pvecm`, disk wipes) are skipped in check mode — they will not be previewed but they also will not run.
|
|
|
|
```bash
|
|
ansible-playbook deploy.yml -i inventories/<customer>/hosts.ini --check --diff
|
|
```
|
|
|
|
## Step 4 — Deploy
|
|
|
|
```bash
|
|
ansible-playbook deploy.yml -i inventories/<customer>/hosts.ini
|
|
```
|
|
|
|
The playbook runs across all nodes in parallel (20 forks by default). Phases that require serial ordering — cluster join, Linstor node registration — are internally throttled or pinned to Node 1.
|
|
|
|
## Idempotency
|
|
|
|
The playbook is safe to re-run. Every task checks current state before acting. If a run fails partway through due to a transient issue (network blip, APT lock), re-running the same command resumes from the failure point — successful tasks are skipped.
|
|
|
|
## Reboots
|
|
|
|
If `apt dist-upgrade` installs a new kernel or critical library, `/var/run/reboot-required` is created. Ansible detects this, reboots the node gracefully, and polls SSH for up to 10 minutes before resuming. An explicit sync barrier ensures all nodes are back online before the clustering phase begins.
|
|
|
|
## Performance Notes
|
|
|
|
`ansible.cfg` is tuned with `pipelining = True` and `forks = 20`. For large standalone deployments (many independent nodes), all nodes are provisioned simultaneously. If uplink bandwidth is limited, lower `forks` in `ansible.cfg` to stagger `apt dist-upgrade` traffic.
|
|
|
|
---
|
|
|
|
[Previous: Configuring the Inventory](02-configuration.md) | [Index](../README.md) | [Next: Architecture & Phase Breakdown](04-architecture.md)
|