Перейти к содержанию
Skillpedia
Деплой и облако (DevOps)18k · #10662

ansible

Что он делает

Этот скилл помогает писать автоматизацию на Ansible: плейбуки, роли, инвентари и работу с секретами через Vault. Он нужен тем, кто управляет серверами и инфраструктурой с помощью Ansible.

Когда использовать

  • ✓Когда нужен плейбук Ansible для настройки или обновления серверов.
  • ✓Когда вы хотите организовать автоматизацию в повторно используемые роли и инвентари.
  • ✓Когда пароли нужно хранить в Ansible Vault, а не открытым текстом.

Ссылка на скилл

https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/ansible/SKILL.md

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/ansible/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Напиши роль Ansible, которая устанавливает и настраивает nginx на наших веб-серверах, а секреты хранятся в Vault.”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Скилл задаёт принципы, например идемпотентные задачи, понятные названия задач и проверенные плейбуки, а также приёмы для ролей, шаблонов и зашифрованных переменных.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

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:, and post_tasks: sections in that order
  • Use ansible-galaxy init to 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_string for inline variable encryption within otherwise plaintext files
  • Leverage block/rescue/always for error handling and cleanup tasks within playbooks

Common Patterns

  • Handler Notification: Use notify: restart nginx on 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: 2 or serial: "25%" on the play to update hosts in batches, combined with max_fail_percentage to halt on excessive failures
  • Fact Caching: Enable fact_caching = jsonfile in ansible.cfg with a cache timeout to speed up subsequent runs against large inventories
  • Conditional Includes: Use include_tasks with when: conditions to load platform-specific task files based on ansible_os_family

Pitfalls to Avoid

  • Do not use command or shell modules 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: true for 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
Частые вопросы

Что значит идемпотентный?

Это значит, что двойной запуск плейбука даёт тот же результат, что и один запуск, поэтому его безопасно повторять.

Как обрабатываются секреты?

Скилл рекомендует шифровать их через Ansible Vault и никогда не коммитить учётные данные открытым текстом.

Как тестировать плейбук?

Скилл советует molecule или ansible-lint перед применением плейбука на продакшен-серверах.

Подробности

Оригинальное описание автора

Ansible automation expert for playbooks, roles, inventories, and infrastructure management

repo: RightNow-AI/openfang

Популярность

Звёзды на GitHub
18k
Место в рейтинге
#10662
Лицензия
Apache-2.0
Обновлён
02.07.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы