$ recombobulate _
home / tips / generate-ansible-playbooks-from-a-plain-english-description
0

Generate Ansible Playbooks from a Plain-English Description

bagwaa @bagwaa · Mar 26, 2026 · Workflows
generate-ansible-playbooks-from-a-plain-english-description

Writing Ansible YAML from scratch means hunting through module docs and getting the indentation wrong — describe what you need and let Claude write it.

claude "Write an Ansible playbook that provisions a fresh Ubuntu 24.04 server: install nginx, create a deploy user with a specific SSH key, configure a firewall with ufw, and enable automatic security updates. Use best practices and idempotent tasks throughout."

Claude produces a well-structured playbook with properly namespaced variables, handlers for service restarts, and become: yes only where it's actually needed — not slapped on every task.

For multi-environment setups, ask Claude to split it into roles:

claude "Read the existing playbook at deploy/site.yml and refactor it into proper Ansible roles — webserver, database, and monitoring — with a group_vars directory structure for staging and production."

Claude handles the boilerplate you always forget: meta/main.yml, defaults/main.yml with sensible variable defaults, and handlers/main.yml wired up correctly.

You can also paste an existing bash setup script and ask Claude to convert it to idempotent Ansible tasks:

cat setup.sh | claude -p "Convert this bash script into idempotent Ansible tasks. Use the appropriate modules instead of raw shell commands wherever possible."

If you can describe your infrastructure in plain English, Claude can write the Ansible to build it.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Scan Pending Changes for Security Issues with /security-review

The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.

bagwaa @bagwaa · 1 hour ago
0
Run Setup Scripts on Every Session with the SessionStart Hook

The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.

bagwaa @bagwaa · 1 hour ago
0
Write Property-Based Tests with fast-check and Claude

Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.

bagwaa @bagwaa · 2 hours ago