Interview Prep/Ansible/Project Structure and Design

What makes a well-designed role?

IntermediateProductionProject Structure and Design
Answer
  • Single responsibility (nginx, not "web stack plus monitoring plus users").
  • A documented interface: prefixed variables in defaults/, validated by argument_specs.
  • Idempotent, supports check mode, and tested with Molecule on the OSes you run.
  • No hidden coupling to inventory group names or other roles' variables.
  • Handlers with unique, prefixed names.
  • Sensible defaults that work out of the box, with secure settings on by default.

If using the role requires reading its tasks, the interface is not good enough.

All Ansible questions Roadmap: Ansible

More on Project Structure and Design