Spec-Zone.ru › Ansible

Ansible tips and tricks

Note

Making Open Source More Inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. We ask that you open an issue or pull request if you come upon a term that we have missed. For more details, see our CTO Chris Wright’s message.

Welcome to the Ansible tips and tricks guide. These tips and tricks have helped us optimize our Ansible usage and we offer them here as suggestions. We hope they will help you organize content, write playbooks, maintain inventory, and execute Ansible. Ultimately, though, you should use Ansible in the way that makes the most sense for your organization and your goals.

  • General tips
    • Keep it simple
    • Use version control
    • Customize the CLI output
    • Avoid configuration-dependent content
  • Playbook tips
    • Use whitespace
    • Always name plays, tasks, and blocks
    • Always mention the state
    • Use comments
    • Use fully qualified collection names
  • Inventory tips
    • Use dynamic inventory with clouds
    • Group inventory by function
    • Separate production and staging inventory
    • Keep vaulted variables safely visible
  • Execution tricks
    • Use Execution Environments
    • Try it in staging first
    • Update in batches
    • Handling OS and distro differences
  • Sample Ansible setup
    • Sample directory layout
    • Alternative directory layout
    • Sample group and host variables
    • Sample playbooks organized by function
    • Sample task and handler files in a function-based role
    • What the sample setup enables
    • Organizing for deployment or configuration
    • Using local Ansible modules

© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/tips_tricks/index.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API