ansible
2
总安装量
2
周安装量
#67909
全站排名
安装命令
npx skills add https://github.com/poindexter12/waypoint --skill ansible
Agent 安装分布
openclaw
2
claude-code
2
github-copilot
2
codex
2
kimi-cli
2
gemini-cli
2
Skill 文档
Ansible Skill
Ansible automation reference for configuration management and application deployment.
Quick Reference
# Test connectivity
ansible all -m ping
ansible <group> -m ping
# Run playbook
ansible-playbook playbook.yml
ansible-playbook playbook.yml -l <host> # Limit to host
ansible-playbook playbook.yml --check # Dry-run
ansible-playbook playbook.yml -vvv # Verbose
# Tags
ansible-playbook playbook.yml --tags "deploy"
ansible-playbook playbook.yml --skip-tags "backup"
ansible-playbook playbook.yml --list-tags
# Variables
ansible-playbook playbook.yml -e "var=value"
ansible-playbook playbook.yml -e "@vars.yml"
# Ad-hoc commands
ansible <group> -m shell -a "command"
ansible <group> -m copy -a "src=file dest=/path"
ansible <group> -m apt -a "name=package state=present"
# Galaxy
ansible-galaxy collection install -r requirements.yml
ansible-galaxy role install <role>
Reference Files
Load on-demand based on task:
| Topic | File | When to Load |
|---|---|---|
| Playbook Structure | playbooks.md | Writing playbooks |
| Inventory | inventory.md | Host/group configuration |
| Variables | variables.md | Variable precedence, facts |
| Modules | modules.md | Common module reference |
| Troubleshooting | troubleshooting.md | Common errors, debugging |
Proxmox Integration
| Topic | File | When to Load |
|---|---|---|
| Proxmox Modules | proxmox/modules.md | VM/LXC management via API |
| Proxmox Auth | proxmox/authentication.md | API tokens, credentials |
| Proxmox Gotchas | proxmox/gotchas.md | Common issues, workarounds |
| Dynamic Inventory | proxmox/dynamic-inventory.md | Auto-discover VMs/containers |
Docker Integration
| Topic | File | When to Load |
|---|---|---|
| Docker Deployment | docker/deployment.md | Containers, images, networks, volumes |
| Compose Patterns | docker/compose-patterns.md | Roles, templates, multi-service stacks |
| Docker Troubleshooting | docker/troubleshooting.md | Common errors, debugging |
Playbook Quick Reference
---
- name: Deploy application
hosts: webservers
become: true
vars:
app_port: 8080
pre_tasks:
- name: Validate requirements
ansible.builtin.assert:
that:
- app_secret is defined
tasks:
- name: Install packages
ansible.builtin.apt:
name: "{{ item }}"
state: present
loop:
- nginx
- python3
- name: Deploy config
ansible.builtin.template:
src: app.conf.j2
dest: /etc/app/app.conf
notify: Restart app
handlers:
- name: Restart app
ansible.builtin.service:
name: app
state: restarted
post_tasks:
- name: Verify deployment
ansible.builtin.uri:
url: "http://localhost:{{ app_port }}/health"
Variable Precedence (High to Low)
- Extra vars (
-e "var=value") - Task vars
- Block vars
- Role/include vars
- Play vars
- Host facts
- host_vars/
- group_vars/
- Role defaults
Directory Structure
ansible/
âââ ansible.cfg # Configuration
âââ inventory/
â âââ hosts.yml # Inventory
âââ group_vars/
â âââ all.yml # All hosts
â âââ webservers.yml # Group-specific
âââ host_vars/
â âââ server1.yml # Host-specific
âââ roles/
â âââ app/
â âââ tasks/
â âââ handlers/
â âââ templates/
â âââ files/
â âââ defaults/
âââ playbooks/
â âââ deploy.yml
âââ templates/
â âââ config.j2
âââ requirements.yml # Galaxy dependencies
Idempotency Checklist
- Tasks produce same result on repeated runs
- No
changed_when: trueunless necessary - Use
state: present/absentnotshellcommands - Check mode (
--check) shows accurate changes - Second run shows all “ok” (no changes)