ansible-playbooks

$npx mdskill add TheBushidoCollective/han/ansible-playbooks

Organizes and writes Ansible playbooks for automated configuration management and infrastructure orchestration.

  • Helps automate server setup and application deployment through structured playbooks.
  • Integrates with Ansible for managing packages, files, and services on remote hosts.
  • Recommends best practices like using roles and handlers based on common patterns.
  • Presents results as YAML code examples and configuration templates for clarity.

SKILL.md

.github/skills/ansible-playbooksView on GitHub ↗
---
name: ansible-playbooks
user-invocable: false
description: Use when writing and organizing Ansible playbooks for automated configuration management and infrastructure orchestration.
allowed-tools: []
---

# Ansible Playbooks

Writing and organizing Ansible playbooks for configuration management.

## Basic Playbook

```yaml
---
- name: Configure web servers
  hosts: webservers
  become: yes
  
  vars:
    http_port: 80
    app_version: "1.0.0"
  
  tasks:
    - name: Install nginx
      apt:
        name: nginx
        state: present
        update_cache: yes
    
    - name: Start nginx
      service:
        name: nginx
        state: started
        enabled: yes
    
    - name: Deploy application
      copy:
        src: ./app
        dest: /var/www/html
        owner: www-data
        mode: '0755'
```

## Inventory

```ini
[webservers]
web1.example.com
web2.example.com

[databases]
db1.example.com

[production:children]
webservers
databases
```

## Common Modules

### Package Management

```yaml
- name: Install packages
  apt:
    name:
      - nginx
      - git
      - python3
    state: present
```

### File Operations

```yaml
- name: Copy configuration
  template:
    src: nginx.conf.j2
    dest: /etc/nginx/nginx.conf
    backup: yes
  notify: Restart nginx
```

### Handlers

```yaml
handlers:
  - name: Restart nginx
    service:
      name: nginx
      state: restarted
```

## Best Practices

### Use Roles

```
roles/
├── webserver/
│   ├── tasks/
│   │   └── main.yml
│   ├── handlers/
│   │   └── main.yml
│   └── templates/
│       └── nginx.conf.j2
```

### Idempotency

```yaml
- name: Ensure directory exists
  file:
    path: /opt/app
    state: directory
    mode: '0755'
```

More from TheBushidoCollective/han

SkillDescription
absinthe-resolversUse when implementing GraphQL resolvers with Absinthe. Covers resolver patterns, dataloader integration, batching, and error handling.
absinthe-schemaUse when designing GraphQL schemas with Absinthe. Covers type definitions, interfaces, unions, enums, and schema organization patterns.
absinthe-subscriptionsUse when implementing real-time GraphQL subscriptions with Absinthe. Covers Phoenix channels, PubSub, and subscription patterns.
act-docker-setupUse when configuring Docker environments for act, selecting runner images, managing container resources, or troubleshooting Docker-related issues with local GitHub Actions testing.
act-local-testingUse when testing GitHub Actions workflows locally with act. Covers act CLI usage, Docker configuration, debugging workflows, and troubleshooting common issues when running workflows on your local machine.
act-workflow-syntaxUse when creating or modifying GitHub Actions workflow files. Provides guidance on workflow syntax, triggers, jobs, steps, and expressions for creating valid GitHub Actions workflows that can be tested locally with act.
ameba-configurationUse when configuring Ameba rules and settings for Crystal projects including .ameba.yml setup, rule management, severity levels, and code quality enforcement.
ameba-custom-rulesUse when creating custom Ameba rules for Crystal code analysis including rule development, AST traversal, issue reporting, and rule testing.
ameba-integrationUse when integrating Ameba into development workflows including CI/CD pipelines, pre-commit hooks, GitHub Actions, and automated code review processes.
analyze-performanceAnalyze performance metrics and identify slow transactions in Sentry