Skip to content

Commit 3f6e567

Browse files
committed
add per-plugin example runbooks
1 parent 922d899 commit 3f6e567

76 files changed

Lines changed: 3007 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/runbooks/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Local lab secrets must not be committed.
2+
lab-secrets.local.yaml
3+
*.local.yaml

examples/runbooks/README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Automax per-plugin smoke runbooks
2+
3+
These examples live in the repository under `examples/runbooks`; no `/tmp` extraction step is required.
4+
5+
Contents:
6+
7+
- `runbooks/*.check.yaml`: one check-mode runbook per plugin or plugin family.
8+
- `RUNBOOK_INDEX.md`: plugin index and substep counts.
9+
- `lab-inventory.example.yaml`, `lab-vars.example.yaml`, `lab-secrets.example.yaml`: minimal lab examples.
10+
- `controller-fixtures/`: local controller-side fixtures for plugins that need source files or directories.
11+
- `scripts/`: small helpers to run one check or all checks.
12+
13+
These runbooks are intended for `automax run --check`. They validate rendering, parameter validation, preview/manual coverage, and per-plugin coverage one plugin at a time. They are not ordered runtime smoke flows and they are not destructive workflows.
14+
15+
## Setup
16+
17+
From the Automax repository:
18+
19+
```bash
20+
cd examples/runbooks
21+
22+
export RB="$PWD"
23+
export INV="$RB/lab-inventory.example.yaml"
24+
export VARS="$RB/lab-vars.example.yaml"
25+
26+
cp lab-secrets.example.yaml lab-secrets.local.yaml
27+
$EDITOR lab-secrets.local.yaml
28+
export SECRETS="$RB/lab-secrets.local.yaml"
29+
```
30+
31+
`lab-secrets.example.yaml` intentionally contains empty values only. Populate `lab-secrets.local.yaml` locally and do not commit it. The local file is ignored by the `examples/runbooks/.gitignore` rules.
32+
33+
`lab-vars.example.yaml` uses `controller-fixtures` as a relative path when commands are launched from `examples/runbooks`. The helper scripts pass an absolute path to avoid ambiguity.
34+
35+
## Run one plugin
36+
37+
Example for `ufw`:
38+
39+
```bash
40+
python -m automax.cli.cli run \
41+
--job "$RB/runbooks/64-ufw.check.yaml" \
42+
--inventory "$INV" \
43+
--vars "$VARS" \
44+
--secrets "$SECRETS" \
45+
--sudo-password-env AUTOMAX_SUDO_PASSWORD \
46+
--var automax_controller_fixture_root="$RB/controller-fixtures" \
47+
--check
48+
```
49+
50+
Or use the helper:
51+
52+
```bash
53+
"$RB/scripts/run-one-check.sh" 64-ufw
54+
```
55+
56+
The helper also accepts the full relative path:
57+
58+
```bash
59+
"$RB/scripts/run-one-check.sh" runbooks/64-ufw.check.yaml
60+
```
61+
62+
## Run all per-plugin check runbooks
63+
64+
```bash
65+
"$RB/scripts/run-all-checks.sh"
66+
```
67+
68+
The helpers respect optional overrides:
69+
70+
```bash
71+
INV=/path/to/inventory.yaml \
72+
VARS=/path/to/vars.yaml \
73+
SECRETS=/path/to/lab-secrets.local.yaml \
74+
AUTOMAX_SUDO_PASSWORD_ENV=AUTOMAX_SUDO_PASSWORD \
75+
"$RB/scripts/run-all-checks.sh"
76+
```

examples/runbooks/RUNBOOK_INDEX.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Automax per-plugin smoke runbooks
2+
3+
Per-plugin runbooks only. No combined runbook, no reused runtime smoke flow, and no separate destructive workflow.
4+
5+
| File | Plugin/family | Substeps |
6+
|---|---:|---:|
7+
| `runbooks/01-alternatives.check.yaml` | `alternatives` | 3 |
8+
| `runbooks/02-apparmor.check.yaml` | `apparmor` | 8 |
9+
| `runbooks/03-archive.check.yaml` | `archive` | 6 |
10+
| `runbooks/04-assert.check.yaml` | `assert` | 5 |
11+
| `runbooks/05-auditd.check.yaml` | `auditd` | 8 |
12+
| `runbooks/06-authselect.check.yaml` | `authselect` | 1 |
13+
| `runbooks/07-backup.check.yaml` | `backup` | 9 |
14+
| `runbooks/08-blkid.check.yaml` | `blkid` | 1 |
15+
| `runbooks/09-block.check.yaml` | `block` | 12 |
16+
| `runbooks/10-capability.check.yaml` | `capability` | 1 |
17+
| `runbooks/11-cert.check.yaml` | `cert` | 11 |
18+
| `runbooks/12-chrony.check.yaml` | `chrony` | 3 |
19+
| `runbooks/13-cron.check.yaml` | `cron` | 5 |
20+
| `runbooks/14-db.check.yaml` | `db` | 5 |
21+
| `runbooks/15-download.check.yaml` | `download` | 1 |
22+
| `runbooks/16-env.check.yaml` | `env` | 1 |
23+
| `runbooks/17-facts.check.yaml` | `facts` | 5 |
24+
| `runbooks/18-findmnt.check.yaml` | `findmnt` | 1 |
25+
| `runbooks/19-firewalld.check.yaml` | `firewalld` | 11 |
26+
| `runbooks/20-fs.check.yaml` | `fs` | 27 |
27+
| `runbooks/21-fstab.check.yaml` | `fstab` | 4 |
28+
| `runbooks/22-group.check.yaml` | `group` | 5 |
29+
| `runbooks/23-health.check.yaml` | `health` | 4 |
30+
| `runbooks/24-hostname.check.yaml` | `hostname` | 1 |
31+
| `runbooks/25-hosts.check.yaml` | `hosts` | 1 |
32+
| `runbooks/26-http.check.yaml` | `http` | 3 |
33+
| `runbooks/27-iptables.check.yaml` | `iptables` | 9 |
34+
| `runbooks/28-journal.check.yaml` | `journal` | 2 |
35+
| `runbooks/29-kernel.check.yaml` | `kernel` | 8 |
36+
| `runbooks/30-limits.check.yaml` | `limits` | 1 |
37+
| `runbooks/31-local.check.yaml` | `local` | 1 |
38+
| `runbooks/32-log.check.yaml` | `log` | 2 |
39+
| `runbooks/33-login.check.yaml` | `login` | 1 |
40+
| `runbooks/34-lvm.check.yaml` | `lvm` | 12 |
41+
| `runbooks/35-mail.check.yaml` | `mail` | 1 |
42+
| `runbooks/36-mount.check.yaml` | `mount` | 6 |
43+
| `runbooks/37-multipath.check.yaml` | `multipath` | 3 |
44+
| `runbooks/38-network.check.yaml` | `network` | 10 |
45+
| `runbooks/39-nftables.check.yaml` | `nftables` | 6 |
46+
| `runbooks/40-pam.check.yaml` | `pam` | 14 |
47+
| `runbooks/41-password.check.yaml` | `password` | 1 |
48+
| `runbooks/42-pkg.check.yaml` | `pkg` | 18 |
49+
| `runbooks/43-pki.check.yaml` | `pki` | 3 |
50+
| `runbooks/44-platform.check.yaml` | `platform` | 1 |
51+
| `runbooks/45-plugin.check.yaml` | `plugin` | 1 |
52+
| `runbooks/46-process.check.yaml` | `process` | 5 |
53+
| `runbooks/47-remote.check.yaml` | `remote` | 1 |
54+
| `runbooks/48-resolver.check.yaml` | `resolver` | 2 |
55+
| `runbooks/49-secret.check.yaml` | `secret` | 3 |
56+
| `runbooks/50-selinux.check.yaml` | `selinux` | 6 |
57+
| `runbooks/51-ssh.check.yaml` | `ssh` | 8 |
58+
| `runbooks/52-sshd.check.yaml` | `sshd` | 2 |
59+
| `runbooks/53-sudo.check.yaml` | `sudo` | 5 |
60+
| `runbooks/54-sudoers.check.yaml` | `sudoers` | 1 |
61+
| `runbooks/55-swap.check.yaml` | `swap` | 3 |
62+
| `runbooks/56-sysctl.check.yaml` | `sysctl` | 7 |
63+
| `runbooks/57-system.check.yaml` | `system` | 1 |
64+
| `runbooks/58-systemctl.check.yaml` | `systemctl` | 12 |
65+
| `runbooks/59-systemd.check.yaml` | `systemd` | 4 |
66+
| `runbooks/60-timedatectl.check.yaml` | `timedatectl` | 3 |
67+
| `runbooks/61-tool.check.yaml` | `tool` | 2 |
68+
| `runbooks/62-transfer.check.yaml` | `transfer` | 4 |
69+
| `runbooks/63-udev.check.yaml` | `udev` | 7 |
70+
| `runbooks/64-ufw.check.yaml` | `ufw` | 6 |
71+
| `runbooks/65-user.check.yaml` | `user` | 11 |
72+
| `runbooks/66-wait.check.yaml` | `wait` | 5 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
upload fixture
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
upload fixture
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Example only. You can keep using your existing /mnt/data/automax-full-plugin-lab/lab-full-plugin-inventory.yaml.
2+
servers:
3+
lab01:
4+
host: 192.168.1.100
5+
groups: [ssh, lab]
6+
# Optional, but recommended for plugin-smoke-04-storage-destructive.yaml
7+
# when each VM has a different /dev/disk/by-id path.
8+
# vars:
9+
# automax_lab_disk: /dev/disk/by-id/REPLACE_ME_LAB01_EMPTY_DISK
10+
ssh:
11+
user: "{{ secrets.ssh_user }}"
12+
password: "{{ secrets.ssh_password }}"
13+
missing_host_key_policy: reject
14+
look_for_keys: false
15+
allow_agent: false
16+
lab02:
17+
host: 192.168.1.101
18+
groups: [ssh, lab]
19+
# Optional, but recommended for plugin-smoke-04-storage-destructive.yaml
20+
# when each VM has a different /dev/disk/by-id path.
21+
# vars:
22+
# automax_lab_disk: /dev/disk/by-id/REPLACE_ME_LAB02_EMPTY_DISK
23+
ssh:
24+
user: "{{ secrets.ssh_user }}"
25+
password: "{{ secrets.ssh_password }}"
26+
missing_host_key_policy: reject
27+
look_for_keys: false
28+
allow_agent: false
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Example only. Copy this file to lab-secrets.local.yaml, fill it locally,
2+
# and keep populated secret files out of Git.
3+
ssh_user:
4+
ssh_password:
5+
smtp_password:
6+
postgres_password:
7+
mysql_password:
8+
oracle_password:
9+
automax_smoke_user_password:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Relative to examples/runbooks when commands are launched from this directory.
2+
# The helper scripts override this with an absolute path.
3+
automax_controller_fixture_root: controller-fixtures
4+
automax_lab_root: /tmp/automax-smoke
5+
automax_lab_acl_user: ubuntu
6+
# Optional placeholder used by storage-related check previews only.
7+
# Per-plugin files in runbooks/ are intended for --check mode.
8+
automax_lab_disk: /dev/disk/by-id/REPLACE_ME_EMPTY_5GB_DISK
9+
automax_lab_confirm_destroy: "no"
10+
deploy_public_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDemo automax@example
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Check-only plugin catalog. Run with automax run --check, not as a normal runtime job.
2+
apiVersion: automax.io/v1
3+
kind: Job
4+
metadata:
5+
name: plugin-smoke-check-alternatives
6+
tasks:
7+
- id: alternatives
8+
description: Check-mode catalog for alternatives plugins.
9+
targets: all
10+
tags:
11+
- all-functions
12+
- check
13+
- alternatives
14+
steps:
15+
- id: catalog
16+
substeps:
17+
- id: alternatives_get
18+
use: alternatives.get
19+
with:
20+
name: nginx
21+
- id: alternatives_list
22+
use: alternatives.list
23+
with:
24+
sudo: true
25+
- id: alternatives_set
26+
use: alternatives.set
27+
with:
28+
name: nginx
29+
path: /tmp/automax-demo
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Check-only plugin catalog. Run with automax run --check, not as a normal runtime job.
2+
apiVersion: automax.io/v1
3+
kind: Job
4+
metadata:
5+
name: plugin-smoke-check-apparmor
6+
tasks:
7+
- id: apparmor
8+
description: Check-mode catalog for apparmor plugins.
9+
targets: all
10+
tags:
11+
- all-functions
12+
- check
13+
- apparmor
14+
steps:
15+
- id: catalog
16+
substeps:
17+
- id: apparmor_complain
18+
use: apparmor.complain
19+
with:
20+
profile: /etc/apparmor.d/usr.sbin.nginx
21+
- id: apparmor_disable
22+
use: apparmor.disable
23+
with:
24+
profile: /etc/apparmor.d/usr.sbin.nginx
25+
confirm: true
26+
- id: apparmor_enforce
27+
use: apparmor.enforce
28+
with:
29+
profile: /etc/apparmor.d/usr.sbin.nginx
30+
- id: apparmor_parser_validate
31+
use: apparmor.parser_validate
32+
with:
33+
profile: /etc/apparmor.d/usr.sbin.nginx
34+
- id: apparmor_profile
35+
use: apparmor.profile
36+
with:
37+
profile: /etc/apparmor.d/usr.sbin.nginx
38+
state: enforce
39+
sudo: true
40+
- id: apparmor_profile_assert
41+
use: apparmor.profile_assert
42+
with:
43+
profile: /etc/apparmor.d/usr.sbin.nginx
44+
state: present
45+
- id: apparmor_reload
46+
use: apparmor.reload
47+
with:
48+
profile: /etc/apparmor.d/usr.sbin.nginx
49+
sudo: true
50+
- id: apparmor_status
51+
use: apparmor.status
52+
with:
53+
sudo: true

0 commit comments

Comments
 (0)