/server-setup:infra-iacfrom server-setup
Operates servers and infrastructure via Ansible, Terraform/OpenTofu, and Kubernetes. Handles debugging, one-off jobs, and persistent changes through IaC with security and vault enforcement.
Ships in server-setup. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
You operate real servers. Mistakes cause outages, lockouts and breaches. Be deliberate, keep the repo the source of truth, and keep the user informed.
apt install/docker run/
iptables -A/editing config over SSH — except declared break-glass (see intake 4).ahmz1833.server_setup can
manage must be managed by it (users, SSH, firewall, packages, sysctl, Docker, containers,
nginx, certificates, k3s, mail, sandboxes, proxies, exporters, binaries via asset).
Don't re-implement or override it with local roles, shell:, templates or other tools.
Missing option → use the role anyway + upstream request (iac-standard.md §5).vault.yml files. Public service domains and standard public ports may stay plain.
Decide per value with judgment — see references/security.md Part A.references/security.md Part B.check first; then ask the user, stating
environment, LIMIT, TAGS and what changes. Never apply to everything to "test".Run these checks (read-only) and pick the branch:
| You find | Context | Do |
|---|---|---|
galaxy.yml with name: server_setup | the collection repo itself | switch to the server-setup-dev skill |
| the request is "why is X down/slow/unstable", benchmark, bandwidth, IP reputation | diagnostics | use the server-diagnostics skill (in whatever project context applies) |
ansible.cfg / inventories/ / playbooks (with or without ahmz1833.server_setup), terraform//*.tf, k8s manifests/Helm values | an existing IaC project | continue below |
| nothing infra-related, or the user wants a new infra | no project yet | switch to the infra-bootstrap skill |
In an existing project:
AGENTS.md/CLAUDE.md/README.md and the Makefile (make help) first.references/iac-standard.md §4). Do not restructure as a side effect. Suggest
improvements separately.AGENTS.md? Offer to add one (template: infra-bootstrap's assets/starter/AGENTS.md)
once you understand the project. Don't force it.If ansible-playbook doesn't work or the collection isn't installed:
make setup if the project has the standard Makefile, otherwise run
scripts/ensure-toolchain.sh <project-dir> (bundled with this skill). It creates a .venv if
needed and installs/upgrades the latest ahmz1833.server_setup into ./collections.
Container status/logs on a host (read-only): make docker-logs H=<host> [C=<container>] [N=200] [SINCE=10m].
Commands on servers: make shell H=<host|group> -- <cmd> (or CMD='<cmd>' when it contains
= or quotes; sudo by default, SUDO=0 for the login user); any module:
make module H=… M=<module> A='<args>'; a variable's value: make var H=<host> V=<var>.
Inventory and vault resolve the connection, so you never handle addresses.
No Python available: make docker-shell (runner image). Details: references/toolchain.md.
Projects without the standard layout: use their own entry points, or plain
ansible-playbook -i <inventory> <playbook> with their vault options.
State the classification and your plan in one or two lines before acting.
| Kind | Examples | How |
|---|---|---|
| 1. Inspect / answer | status, logs, "why is X slow/down", disk, versions, who has access | Read-only commands only (make shell H=<host> -- <cmd>, make docker-logs, make var, kubectl get). Report findings. No writes. |
| 2. One-off operation | restart/reload, reboot, drain/uncordon, fetch kubeconfig, backup, prune images, redeploy same image | Prefer: existing playbooks/ops/* → collection entry point (e.g. k3s k3s_state) → ad-hoc module. Confirm before anything disruptive (reboot, drain, restart of prod services). If the job will recur, add it as playbooks/ops/<job>.yml. |
| 3. Persistent change | add user/key, open port, add site/app/domain/host, change config, upgrade versions | The change loop below. Always. |
| 4. Emergency | prod down, active attack, locked out | Minimal manual fix with the user's OK, log every command, then codify (repo matches host, check shows no diff) or revert — before the session ends. |
If a task turns out to need a lasting change midway (typical for kind 1 → fix), switch to kind 3 explicitly and tell the user.
make host H=<host> (vault values hidden). Avoid raw
ansible-inventory --host, which prints decrypted vault values.grep -rn '<var>' inventories/ playbooks/.references/roles-index.md (all roles), ansible-doc -t role ahmz1833.server_setup.<role>,
or the source at collections/ansible_collections/ahmz1833/server_setup/roles/<role>/
(defaults/main.yml, README.md, tasks/). Read the role's tasks when behaviour matters.x: "{{ vault_x }}", the key added to
vault.yml.example with a fake value, and the real value put in by the user (hand-off,
see "Secrets") or by make vault-gen when it can be random. Never write a decrypted vault
to disk and never read one.make validate (argument specs) and make lint if present.make check LIMIT=<hosts> TAGS=<roles> (--check --diff). Read the diff;
explain anything unexpected instead of ignoring it.LIMIT, TAGS, risks
(lockout? restart? downtime?).--check (make apply …). Canary first for many hosts.curl, ss -ltnp, iptables -S HOST-FIREWALL, …).git diff (security.md §12),
make vault-check, then propose a commit (one concern, message without secrets/IPs).
Commit/push only if the user wants that.Lockout-prone changes (SSH port/users/keys, firewall, core_firewall_ssh_src, network):
follow security.md §11 — keep a session open, add the new access before removing the old,
canary host first.
Two classes of vault values (references/security.md §5a):
make host H=<h> shows them, make var H=<h> V=vault_x_ip too.
Keep them out of plaintext repo files and commit messages..vault_pass*, .become_pass*): never read, print or put on a command line. Don't run
make vault-view, ansible-vault view/decrypt/edit or SHOW_VAULT=1.x: "{{ vault_x }}" + placeholder in vault.yml.example.
Random ones: make vault-gen KEY=vault_x FILE=<vault.yml> (never printed). Ones the user
must bring: explicit hand-off (exact make vault-edit FILE=<path> command, key line, where
to obtain it), wait, verify with make vault-keys. One that already exists in another
vault: move it by pipe without printing..become_pass (mode 600) — the
Makefile uses it for every ansible command.make ssh-config so ssh <host> keeps working (if the
project has the target; its AGENTS.md says whether it's mandatory).⚠ HIGH node_exporter :9100 open to the world on web-1 → restrict src to monitoring IP (vault).
Fix unrelated findings only when the user agrees.127.0.0.1.no_log: true on tasks handling them.Availability/performance problems (down, slow, flapping, saturated), benchmarks, network
tests and IP reputation checks: use the server-diagnostics skill — it discovers the
available metrics/logs, analyzes, measures ephemerally and hands durable fixes back here.
Without it: investigate read-only, layer by layer (DNS → network → firewall → TLS → proxy →
app → data), one hypothesis that explains all evidence, fix in code
(references/debugging.md).
| File | When |
|---|---|
references/iac-standard.md | layout, naming, where things go, working in non-standard repos |
references/security.md | vault decisions (A), attack surface (B), review checklist (C), lockout |
references/operations.md | intake model, change loop, safety, drift, day-2, CI deploys |
references/debugging.md | diagnostics cookbook, failure patterns |
references/toolchain.md | setup without ansible/collection, docker runner, offline validation |
references/roles-index.md | every collection variable: type, default, meaning |
Full example projects (flexible starting points and patterns): after make setup,
collections/ansible_collections/ahmz1833/server_setup/examples/ — starter (single
server), multi-env-cluster (staging/prod, k3s, mail, vault ids, local role), fleet
(heterogeneous servers, location groups, CI deploys). Or
https://github.com/ahmz1833/server-setup/tree/master/examples
Only for what the collection genuinely cannot manage (golden rule 2). Anything else is
still IaC with the same rules — decision steps and tool table in
references/iac-standard.md §5:
defaults/main.yml and tasks again — many
behaviours are a toggle or a list item. If the role can do it, use it. If it almost
can, use it for what it covers, complement minimally without touching resources it owns,
and record an upstream request.roles/<name>/ (defaults + tasks + README)
or a play task when tiny. Idempotent, no plain secrets.community.general.cloudflare_dns) in a playbook, or the
project's existing Terraform/OpenTofu. Cloud resources → Terraform/OpenTofu with
encrypted remote state. Kubernetes workloads → manifests/Helm values in git applied via
kubernetes.core or GitOps. Use what the project already uses; don't introduce a new
tool without asking.make target
if it's run regularly).# UPSTREAM-CANDIDATE: <why>, and tell the user it could go into the collection
(server-setup-dev skill covers contributing, with or without write access).references/debugging.md (opens in a new tab)references/iac-standard.md (opens in a new tab)references/operations.md (opens in a new tab)references/roles-index.md (opens in a new tab)references/security.md (opens in a new tab)references/toolchain.md (opens in a new tab)scripts/ensure-toolchain.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ahmz1833/server-setup --plugin server-setup4 skills in this plugin
/infra-bootstrapCreate a new infrastructure-as-code project (Ansible + ahmz1833.server_setup collection) for a server, a set of servers, a cluster, or a new organization/startup/event - from an interview to a runnable, vaulted, validated repo. Use when the user wants to set up, provision or bootstrap new servers/infrastructure and there is no IaC repo for it yet, or asks for a new infra repo. For changing an existing project use infra-iac instead./server-diagnosticsDebug availability and performance of servers and the services on them, and measure/vet machines - outages, downtime, flapping, restarts, slowness, saturation, resource exhaustion, packet loss, throughput; using every metrics/logging source available (Prometheus-style metrics, exporters, logs, Kubernetes metrics, sysstat, provider graphs); plus benchmarks (CPU/memory/disk), network tests between servers or to the internet (iperf3, mtr) and egress/IP reputation checks. Use for any "why is X down/slow/unstable", "is this server good enough", "test bandwidth", "is this IP clean" request, whatever the workload (Kubernetes, VPN/tunnels, web, databases, mail, CI...). Read-only and ephemeral by default; fixes go through infra-iac./server-setup-devDevelop, fix or extend the ahmz1833.server_setup Ansible collection itself (its roles core, node, nginx, acme, apps, sandbox, k3s, mail, asset; argument specs; docs; examples; skills) - or upstream a generic local role into it. Use when working inside the server-setup repository, when a project needs a feature the collection lacks, or when a collection bug is found while operating infrastructure. Covers both maintainers (write access, release workflow) and non-owners (local workaround + issue/PR).