
Ansible Automation
Wrap Ansible playbooks in a repeatable deploy flow with syntax-check, dry-run, confirmation, and post-deploy verify for solo operators shipping to dev or prod.
Overview
Ansible-automation is an agent skill for the Ship phase that scaffolds Ansible playbook deployment with syntax check, dry-run, confirmation, execution, and post-deploy verification.
Install
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill ansible-automationWhat is this skill?
- Bash deploy wrapper with syntax-check, --check dry-run, and interactive confirm before apply
- Parameterized environment, playbook, inventory path, and --limit host group
- Post-deployment verify.yml pass after main playbook completes
- Jinja2 .env-style app config template pattern for role variables
- set -euo pipefail guardrails on the shell entrypoint
Adoption & trust: 1.1k installs on skills.sh; 250 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You know Ansible can deploy your app but every release is a slightly different one-liner with no standard dry-run or verify step.
Who is it for?
Solo builders shipping services to SSH-managed hosts or mixed infra who already maintain playbooks and inventory files.
Skip if: Teams that only deploy via managed PaaS one-click releases with no Ansible inventory, or who need full role/playbook authoring from zero in one skill.
When should I use this skill?
User wants Ansible deployment automation, dry-run before apply, or Jinja2 env templates for app roles.
What do I get? / Deliverables
You get a copy-paste deploy script and config-template patterns so releases follow the same check → confirm → apply → verify sequence.
- ansible-deploy.sh style wrapper
- Jinja2 application config templates for roles
Recommended Skills
Journey fit
Deployment automation is where the product leaves your laptop; Ansible fits the ship phase as launch prep before traffic hits production. Launch subphase covers release execution—inventory limits, environment vars, and verification playbooks are classic go-live mechanics.
How it compares
Opinionated deploy shell around ansible-playbook—not a Terraform/Pulumi provisioner or a Kubernetes Helm chart generator.
Common Questions / FAQ
Who is ansible-automation for?
Indie devops-minded builders who run ansible-playbook against their own inventory and want agent-generated deploy wrappers with safety steps baked in.
When should I use ansible-automation?
During Ship when you are about to promote a build—after tests pass—especially when you need syntax-check and check-mode before touching production hosts.
Is ansible-automation safe to install?
Review the Security Audits panel on this Prism page before trusting generated scripts; any skill that suggests shell and remote deploy commands should be inspected in your repo and run only on non-prod first.
SKILL.md
READMESKILL.md - Ansible Automation
# Ansible Deployment Script ## Ansible Deployment Script ```bash #!/bin/bash # ansible-deploy.sh - Deploy using Ansible set -euo pipefail ENVIRONMENT="${1:-dev}" PLAYBOOK="${2:-site.yml}" INVENTORY="inventory/hosts.ini" LIMIT="${3:-all}" echo "Deploying with Ansible: $PLAYBOOK" echo "Environment: $ENVIRONMENT" echo "Limit: $LIMIT" # Syntax check echo "Checking Ansible syntax..." ansible-playbook --syntax-check \ -i "$INVENTORY" \ -e "environment=$ENVIRONMENT" \ "$PLAYBOOK" # Dry run echo "Running dry-run..." ansible-playbook \ -i "$INVENTORY" \ -e "environment=$ENVIRONMENT" \ -l "$LIMIT" \ --check \ "$PLAYBOOK" # Ask for confirmation read -p "Continue with deployment? (y/n): " -r if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "Deployment cancelled" exit 1 fi # Execute playbook echo "Executing playbook..." ansible-playbook \ -i "$INVENTORY" \ -e "environment=$ENVIRONMENT" \ -l "$LIMIT" \ -v \ "$PLAYBOOK" echo "Deployment complete!" # Run verification echo "Running post-deployment verification..." ansible-playbook \ -i "$INVENTORY" \ -e "environment=$ENVIRONMENT" \ -l "$LIMIT" \ verify.yml ``` # Configuration Template ## Configuration Template ```jinja2 # roles/application/templates/.env.j2 # Environment Configuration NODE_ENV={{ environment }} LOG_LEVEL={{ log_level }} PORT=8080 # Database Configuration DATABASE_URL=postgresql://{{ db_user }}:{{ db_password }}@{{ db_host }}:5432/{{ db_name }} DATABASE_POOL_SIZE=20 DATABASE_TIMEOUT=30000 # Cache Configuration REDIS_URL=redis://{{ redis_host }}:6379 CACHE_TTL=3600 # Application Configuration APP_NAME=MyApp APP_VERSION={{ app_version }} WORKERS={{ ansible_processor_vcpus }} # API Configuration API_TIMEOUT=30000 API_RATE_LIMIT=1000 # Monitoring SENTRY_DSN={{ sentry_dsn | default('') }} DATADOG_API_KEY={{ datadog_api_key | default('') }} ``` # Inventory and Variables ## Inventory and Variables ```yaml # inventory/hosts.ini [webservers] web1 ansible_host=10.0.1.10 web2 ansible_host=10.0.1.11 web3 ansible_host=10.0.1.12 [databases] db1 ansible_host=10.0.2.10 db_role=primary db2 ansible_host=10.0.2.11 db_role=replica [all:vars] ansible_user=ubuntu ansible_ssh_private_key_file=~/.ssh/id_rsa ansible_python_interpreter=/usr/bin/python3 # inventory/group_vars/webservers.yml --- app_version: "1.2.3" app_repo_url: "https://github.com/myorg/myapp.git" environment: production log_level: INFO # inventory/host_vars/web1.yml --- server_role: primary max_connections: 500 ``` # Playbook Structure and Best Practices ## Playbook Structure and Best Practices ```yaml # site.yml - Main playbook --- - name: Deploy application stack hosts: all gather_facts: yes serial: 1 # Rolling deployment pre_tasks: - name: Display host information debug: var: inventory_hostname tags: [always] roles: - common - docker - application post_tasks: - name: Verify deployment uri: url: "http://{{ inventory_hostname }}:8080/health" status_code: 200 retries: 3 delay: 10 tags: [verify] # roles/common/tasks/main.yml --- - name: Update system packages apt: update_cache: yes cache_valid_time: 3600 when: ansible_os_family == 'Debian' - name: Install required packages package: name: "{{ packages }}" state: present vars: packages: - curl - git - htop - python3-pip - name: Configure sysctl settings sysctl: name: "{{ item.name }}" value: "{{ item.value }}" sysctl_set: yes state: present loop: - name: net.core.somaxconn value: 65535 - name: net.ipv4.tcp_max_syn_backlog value: 65535 - name: fs.file-max value: 2097152 - name: Create application user user: name: appuser shell: /bin/bash home: /home/appuser createhome: yes state: present # roles/docker/tasks/main.yml --- - name: Install Docker prerequisites package: name: "{{ docker_packages }}" stat