/mauriciovieira-skills:ansible-kamalfrom mauriciovieira-skills
Use when bootstrapping a Rails project that needs Ubuntu VPS provisioning (Ansible) and Kamal 2 deploy (kamal-proxy on 80/443) — scaffolds infra/ansible, infra/kamal, config/deploy*.yml, .kamal/secrets* templates from a hardened reference layout, asking IP, DNS, and whether the host runs both staging+production or only a single domain.
Ships in mauriciovieira-skills. 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.
Scaffolds a full Ansible + Kamal 2 infrastructure tree for a Rails app on a single Ubuntu VPS. Generates:
Makefile — make deploy ENV=…, make db-restore-from-vps ENV=…, make build, make run-local, make mailhog.scripts/ - kamal-deploy.sh, db-restore-from-vps.sh (provider-agnostic - works with Hetzner, DigitalOcean, OVH, Hostinger, AWS Lightsail, etc., as long as the Ansible inventory points at the box).infra/ansible/ — playbooks (bootstrap, site, dump_db, restore_db), roles (common, users, ssh_bootstrap, firewall, fail2ban, docker, postgresql, traefik, opt), inventory, Makefile (setup, test, bootstrap, ansible), README.infra/kamal/README.md - secrets / secret manager / GitHub Actions guide.config/deploy.yml (+ config/deploy.staging.yml if staging is enabled)..kamal/secrets, .kamal/secrets-common (+ .kamal/secrets.staging if enabled).infra/ansible/ where you want the same hardened baseline (UFW, fail2ban, sshd drop-in, Docker, PG on host).Do NOT use when the project already has infra/ansible/ — diff manually instead, this skill overwrites.
myapp, petshop. Used for DB names (<slug>_production, <slug>_staging), DB users (<slug>_prod_user, <slug>_staging_user), and env var prefix (POSTGRES_<SLUG_UPPER>_PROD_PASSWORD).service: and image name. Default = slug with _→- (e.g. my-app).myorg/<service> for GHCR.inventory/production.yml and config/deploy.yml servers.web.hosts.myapp).staging+production — two Kamal destinations, two DBs, two domains (recommended for production apps).single — only one domain / DB / Kamal destination, no staging plumbing emitted.example.com.staging+production. Default = staging.<production_domain>.site.yml) + Kamal SSH as. Default = <slug>_deploy. Must NOT be root.infra/ansible, so anything relative names two different files - including a wrapper like env FOO=bar bin/secret, whose own first word hides the relative path. render.sh rejects whitespace, $, a backtick, and any value that does not begin with /. Wrap anything that needs environment, arguments or pipelines in a script and name the script.infra/myapp. Default = infra/<inventory_group>.After collecting inputs, derive:
| Placeholder | Value |
|---|---|
__APP_SLUG__ | snake_case slug |
__APP_SERVICE__ | kebab-case service |
__APP_SLUG_UPPER__ | uppercase snake_case (env var prefix) |
__INVENTORY_GROUP__ | inventory group |
__VPS_IP__ | IPv4 |
__DOMAIN_PROD__ | production FQDN |
__DOMAIN_STAGING__ | staging FQDN (or empty in single mode) |
__LETSENCRYPT_EMAIL__ | ACME email |
__DEPLOY_USER__ | deploy linux user |
__IMAGE_REPO__ | container image (no tag) |
__SECRET_CMD__ | absolute path to the secret-printing command, e.g. /usr/local/bin/secret |
__SECRET_NAMESPACE__ | e.g. infra/myapp |
__ENV_MODE__ | staging+production or single |
Run the render script from the target project root (the repo to scaffold INTO):
APP_SLUG=myapp \
APP_SERVICE=my-app \
APP_SLUG_UPPER=MYAPP \
INVENTORY_GROUP=myapp \
VPS_IP=203.0.113.10 \
DOMAIN_PROD=example.com \
DOMAIN_STAGING=staging.example.com \
[email protected] \
DEPLOY_USER=myapp_deploy \
IMAGE_REPO=myorg/my-app \
SECRET_CMD=/usr/local/bin/secret \
SECRET_NAMESPACE=infra/myapp \
ENV_MODE=staging+production \
TARGET_DIR=. \
~/.claude/skills/ansible-kamal/scripts/render.sh
For ENV_MODE=single leave DOMAIN_STAGING empty (or unset). SECRET_CMD must be an absolute path with no whitespace, no $ and no backtick, and must not be under /proc; everything else is rejected, because it would resolve differently depending on which directory invokes it. That check runs at render time only: the generated scripts read SECRET_CMD from the environment if it is set, so SECRET_CMD=bin/secret make deploy bypasses it for that one run.
The script:
templates/, applies placeholder substitution.# >>> staging-only / # <<< staging-only when ENV_MODE=single.*.staging.* and secrets.staging when ENV_MODE=single.*.tmpl → no suffix.infra/ansible/ unless FORCE=1.Tell the user, in order:
cd infra/ansible && make setup && make test — bootstraps venv + galaxy collections + lints.__SECRET_NAMESPACE__/deploy_ssh_{private,public}_key.openssl rand -base64 32, store at __SECRET_NAMESPACE__/postgres___APP_SLUG___prod_password (and _staging_ if applicable).A records: __DOMAIN_PROD__ (+ __DOMAIN_STAGING__) → __VPS_IP__.ufw): allow 22/80/443 from anywhere (or your IP for 22).DEPLOY_SSH_KEY="$(/usr/local/bin/secret __SECRET_NAMESPACE__/deploy_ssh_public_key)" make bootstrap (root reachable).make ansible (loads the PG passwords through SECRET_CMD and provisions site.yml as __DEPLOY_USER__).infra/kamal/README.md.bundle exec kamal setup (production) and bundle exec kamal setup -d staging (if staging).host.docker.internal (add-host: host.docker.internal:host-gateway in deploy.yml).bootstrap.yml only, with MANAGE_BUILTINS=yes and DEFAULT_FORWARD_POLICY=ACCEPT so SSH survives Docker's iptables hooks. Includes nft INPUT rehook task to recover from Docker orphaning UFW jumps.05-ansible-sshd-hardening.conf in bootstrap; cloud-init 50- and 60- removed.systemctl, apt, apt-get. No /etc/ssh editing.Makefile # root: deploy, db-restore-from-vps, build, run-local, mailhog
scripts/kamal-deploy.sh
scripts/db-restore-from-vps.sh
infra/README.md
infra/ansible/ansible.cfg
infra/ansible/Makefile # ansible: setup, test, bootstrap, ansible
infra/ansible/README.md
infra/ansible/requirements.txt
infra/ansible/requirements.yml
infra/ansible/playbooks/{bootstrap,site,dump_db,restore_db}.yml
infra/ansible/inventory/production.yml
infra/ansible/inventory/group_vars/all.yml
infra/ansible/roles/common/tasks/main.yml
infra/ansible/roles/users/tasks/main.yml
infra/ansible/roles/users/library/managed_authorized_key.py # idempotent single-key authorized_keys module
infra/ansible/roles/ssh_bootstrap/{tasks/main.yml,templates/sshd_ansible_hardening.conf.j2,handlers/main.yml}
infra/ansible/roles/firewall/tasks/{main,nft_input_rehook}.yml
infra/ansible/roles/fail2ban/{tasks/main.yml,handlers/main.yml}
infra/ansible/roles/docker/{tasks/main.yml,templates/daemon.json.j2,handlers/main.yml}
infra/ansible/roles/postgresql/{tasks/{main,discover,ufw}.yml,templates/{postgresql.conf,pg_hba.conf,create_databases.sql}.j2,handlers/main.yml}
infra/ansible/roles/opt/tasks/main.yml
infra/ansible/roles/traefik/{tasks/main.yml,templates/{traefik.yml,docker-compose.yml}.j2}
infra/kamal/README.md
config/deploy.yml
config/deploy.staging.yml # only if ENV_MODE=staging+production
.kamal/secrets
.kamal/secrets-common
.kamal/secrets.staging # only if ENV_MODE=staging+production
| Mistake | Fix |
|---|---|
Forgot __VPS_IP__ substitution → bootstrap connects to placeholder | Re-run render.sh; verify inventory/production.yml and config/deploy.yml have the IP. |
Used __APP_SLUG__ with hyphens | Slug must be snake_case; service name is the kebab-case form. Postgres identifiers reject hyphens. |
single mode but staging files present | Set ENV_MODE=single, leave DOMAIN_STAGING empty, re-render. |
Deploy user = root | Disallowed; users role creates it as a non-sudo account with restricted sudoers. Pick <slug>_deploy. |
| Secret names don't match Makefile | __SECRET_NAMESPACE__ flows into the make ansible target. Match what your secret manager actually holds. |
scripts/render.sh (opens in a new tab)templates/Makefile (opens in a new tab)templates/config/deploy.staging.yml (opens in a new tab)templates/config/deploy.yml (opens in a new tab)templates/infra/README.md (opens in a new tab)templates/infra/ansible/Makefile (opens in a new tab)templates/infra/ansible/README.md (opens in a new tab)templates/infra/ansible/ansible.cfg (opens in a new tab)templates/infra/ansible/inventory/group_vars/all.yml (opens in a new tab)templates/infra/ansible/inventory/production.yml (opens in a new tab)templates/infra/ansible/playbooks/bootstrap.yml (opens in a new tab)templates/infra/ansible/playbooks/dump_db.yml (opens in a new tab)templates/infra/ansible/playbooks/restore_db.yml (opens in a new tab)templates/infra/ansible/playbooks/site.yml (opens in a new tab)templates/infra/ansible/requirements.txt (opens in a new tab)templates/infra/ansible/requirements.yml (opens in a new tab)templates/infra/ansible/roles/common/tasks/main.yml (opens in a new tab)templates/infra/ansible/roles/docker/handlers/main.yml (opens in a new tab)templates/infra/ansible/roles/docker/tasks/main.yml (opens in a new tab)templates/infra/ansible/roles/docker/templates/daemon.json.j2 (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mauriciovieira/skills --plugin mauriciovieira-skills45 skills in this plugin
/babysit-with-github-copilotBabysit a PR through GitHub Copilot review until merge. Use when the user asks to "babysit PR/batch-grill-meA relentless interview that asks every frontier question at once, round by round./chrome-devtools-mcpScaffolds a dedicated Chrome instance with an isolated, persistent profile plus a chrome-devtools-mcp (CDP) server registration, so Claude can inspect authenticated network traffic in a web app - list open tabs, navigate, and read real requests (method, URL, sensitive headers, body, response shape) to reverse-engineer an API. Use when the user wants to inspect authenticated traffic in a browser, capture real headers/cookies for an integration, reverse-engineer a web app's undocumented API, or asks to set up chrome-devtools-mcp / CDP debugging.Other plugins' skills for the same job