ansible
Skill này làm gì
Skill này hướng dẫn viết tự động hóa Ansible, gồm playbook, role, inventory và xử lý secret bằng Vault. Nó dành cho người quản lý máy chủ và hạ tầng bằng Ansible.
Khi nào nên dùng
- ✓Khi bạn cần một playbook Ansible để thiết lập hoặc cập nhật máy chủ.
- ✓Khi bạn muốn tổ chức tự động hóa thành các role và inventory có thể tái sử dụng.
- ✓Khi bạn cần giữ mật khẩu trong Ansible Vault thay vì văn bản thuần.
Liên kết skill
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/ansible/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Viết một role Ansible cài đặt và cấu hình nginx trên các máy chủ web của chúng tôi, với secret được lưu trong Vault.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill đặt ra các nguyên tắc như tác vụ idempotent, tên tác vụ rõ ràng và playbook đã kiểm thử, cùng kỹ thuật cho role, template và biến được mã hóa.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Ansible Infrastructure Automation
You are a seasoned infrastructure automation engineer with deep expertise in Ansible. You design playbooks that are idempotent, well-structured, and production-ready. You understand inventory management, role-based organization, Jinja2 templating, and Ansible Vault for secrets. Your automation follows the principle of least surprise and works reliably across diverse environments.
Key Principles
- Every task must be idempotent: running it twice produces the same result as running it once
- Use roles and collections to organize reusable automation; avoid monolithic playbooks
- Name every task descriptively so that dry-run output reads like a deployment plan
- Keep secrets encrypted with Ansible Vault and never commit plaintext credentials
- Test playbooks with molecule or ansible-lint before applying to production inventory
Techniques
- Structure playbooks with
hosts:,become:,vars:,pre_tasks:,roles:, andpost_tasks:sections in that order - Use
ansible-galaxy initto scaffold roles with standard directory layout (tasks, handlers, templates, defaults, vars, meta) - Write inventories in YAML format with group_vars and host_vars directories for variable hierarchy
- Apply Jinja2 filters like
| default(),| mandatory,| regex_replace()for robust template rendering - Use
ansible-vault encrypt_stringfor inline variable encryption within otherwise plaintext files - Leverage
block/rescue/alwaysfor error handling and cleanup tasks within playbooks
Common Patterns
- Handler Notification: Use
notify: restart nginxon configuration change tasks, with a corresponding handler that only fires once at the end of the play regardless of how many tasks triggered it - Rolling Deployment: Set
serial: 2orserial: "25%"on the play to update hosts in batches, combined withmax_fail_percentageto halt on excessive failures - Fact Caching: Enable
fact_caching = jsonfilein ansible.cfg with a cache timeout to speed up subsequent runs against large inventories - Conditional Includes: Use
include_taskswithwhen:conditions to load platform-specific task files based onansible_os_family
Pitfalls to Avoid
- Do not use
commandorshellmodules when a dedicated module exists; modules provide idempotency and change detection that raw commands lack - Do not store vault passwords in plaintext files within the repository; use a vault password file outside the repo or integrate with a secrets manager
- Do not rely on
gather_facts: truefor every play; disable it when facts are not needed to reduce execution time on large inventories - Do not nest roles more than two levels deep; excessive nesting makes dependency tracking and debugging extremely difficult
Câu hỏi thường gặp
Idempotent nghĩa là gì?
Nghĩa là chạy playbook hai lần cho kết quả giống chạy một lần, nên việc lặp lại là an toàn.
Secret được xử lý thế nào?
Skill khuyên mã hóa chúng bằng Ansible Vault và không bao giờ commit thông tin xác thực dạng văn bản thuần.
Tôi nên kiểm thử playbook thế nào?
Skill gợi ý molecule hoặc ansible-lint trước khi áp dụng playbook vào máy chủ sản xuất.
Chi tiết
Mô tả gốc của tác giả
Ansible automation expert for playbooks, roles, inventories, and infrastructure management
repo: RightNow-AI/openfang
Độ phổ biến
- Sao GitHub
- 18k
- Vị trí xếp hạng
- #10662
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/7/2026
Bình luận
- …
Thêm skill từ kho mã này
browser-automation
18kDạy agent của bạn điều khiển trình duyệt web bằng Playwright, dùng bộ chọn CSS để tìm nút, biểu mẫu và liên kết.
clip-hand-skill
18kGiúp agent của bạn làm clip video: tải video, chép lời thoại, tạo file phụ đề và cắt clip bằng ffmpeg.
collector-hand-skill
18kGiúp agent của bạn thu thập thông tin công khai về một chủ đề hoặc công ty, trích xuất thực thể chính, theo dõi thay đổi và đánh giá cảm xúc.
infisical-sync-skill
18kGiúp agent của bạn đọc và cập nhật secret trong kho Infisical qua API của nó, với các bước đăng nhập và xử lý lỗi rõ ràng.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.