PluginBench
Skill
Fail
Audit score 45

ansible-automation

aj-geddes/useful-ai-prompts

Automate infrastructure provisioning, configuration management, and application deployment across multiple servers.

What is ansible-automation?

Ansible Automation enables infrastructure provisioning, configuration management, and application deployment using playbooks, roles, and inventory. Use it for deploying applications, patching servers, managing multi-server orchestration, and automating infrastructure tasks at scale.

  • Deploy applications across multiple servers with rolling updates and health checks
  • Manage server configuration and apply patches consistently across infrastructure
  • Orchestrate multi-server deployments with serial execution and error handling
  • Provision cloud instances and manage container deployments
  • Automate database administration and security compliance tasks
  • Use roles and templates for modular, reusable infrastructure code

How to install ansible-automation

npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill ansible-automation
Prerequisites
  • Ansible installed on control machine
  • SSH access to target servers
  • Inventory file defining target hosts and groups
  • Basic understanding of YAML syntax
Claude Code
Cursor
Windsurf
Cline

How to use ansible-automation

  1. 1.Create an inventory file listing your target hosts and groups
  2. 2.Define roles in the roles/ directory for modular configuration (common, docker, application, etc.)
  3. 3.Write playbooks that reference your roles and define deployment tasks
  4. 4.Use templates for configuration files to avoid hardcoding values
  5. 5.Run playbooks in check mode first to preview changes
  6. 6.Execute playbooks with serial deployment for rolling updates
  7. 7.Implement health checks and verification tasks in post_tasks
  8. 8.Store sensitive data in Ansible vault and reference in playbooks

Use cases

Good for
  • Rolling application deployments with health verification across a fleet of servers
  • Patching and updating configurations consistently across development, staging, and production environments
  • Provisioning and configuring new cloud instances with pre-defined roles and templates
  • Automating security compliance checks and applying configuration standards across infrastructure
  • Managing container deployments and orchestrating multi-tier application stacks
Who it's for
  • DevOps engineers managing multi-server infrastructure
  • System administrators automating configuration management and patching
  • Cloud infrastructure teams provisioning and managing instances
  • Release engineers coordinating application deployments
  • Infrastructure-as-code practitioners building repeatable deployment pipelines

ansible-automation FAQ

What is the difference between playbooks and roles?

Playbooks are YAML files that define the execution flow and tasks for specific hosts. Roles are reusable collections of tasks, handlers, templates, and variables organized in a directory structure for modularity and reuse across multiple playbooks.

How do I manage sensitive data like passwords and API keys?

Use Ansible Vault to encrypt sensitive variables and files. Store vault-encrypted files in version control and provide the vault password at runtime using --vault-password-file or --ask-vault-pass.

What is idempotency and why does it matter?

Idempotency means running a playbook multiple times produces the same result without unintended side effects. Use handlers, conditionals, and state-based modules (like 'present' or 'absent') to ensure tasks only make changes when necessary.

How do I perform rolling deployments without downtime?

Use the 'serial' parameter in your playbook to deploy to a subset of hosts at a time, combined with health checks in post_tasks to verify each batch before proceeding to the next.

Should I run playbooks without checking first?

No. Always use ansible-playbook --check to preview changes in check mode before executing. This helps catch errors and unexpected behavior before affecting production infrastructure.

Full instructions (SKILL.md)

Source of truth, from aj-geddes/useful-ai-prompts.


name: ansible-automation description: > Infrastructure automation and configuration management using Ansible playbooks, roles, and inventory. Use for deploying applications, patching, and managing servers.

Ansible Automation

Table of Contents

Overview

Automate infrastructure provisioning, configuration management, and application deployment across multiple servers using Ansible playbooks, roles, and dynamic inventory management.

When to Use

  • Configuration management
  • Application deployment
  • Infrastructure patching and updates
  • Multi-server orchestration
  • Cloud instance provisioning
  • Container management
  • Database administration
  • Security compliance automation

Quick Start

Minimal working example:

# 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
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Playbook Structure and Best PracticesPlaybook Structure and Best Practices
Inventory and VariablesInventory and Variables
Ansible Deployment ScriptAnsible Deployment Script
Configuration TemplateConfiguration Template

Best Practices

✅ DO

  • Use roles for modularity
  • Implement proper error handling
  • Use templates for configuration
  • Leverage handlers for idempotency
  • Use serial deployment for rolling updates
  • Implement health checks
  • Store inventory in version control
  • Use vault for sensitive data

❌ DON'T

  • Use command/shell without conditionals
  • Copy files without templates
  • Run without check mode first
  • Mix environments in inventory
  • Hardcode values
  • Ignore error handling
  • Use shell for simple tasks