# Best practices to implement and manage custom app with ansible

**URL:** <https://forum.ansible.com/t/best-practices-to-implement-and-manage-custom-app-with-ansible/44334>\
**Category:** Get Help\
**Created:** [August 20, 2025, 4:05pm UTC](https://forum.ansible.com/t/best-practices-to-implement-and-manage-custom-app-with-ansible/44334 "2025-08-20T16:05:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rebug](https://avatars.discourse-cdn.com/v4/letter/r/8e7dd6/32.png) [@rebug](https://forum.ansible.com/u/rebug)\
**Post date:** [August 20, 2025, 4:05pm UTC](https://forum.ansible.com/t/best-practices-to-implement-and-manage-custom-app-with-ansible/44334/1 "2025-08-20T16:05:08Z")

</div>

Hello,

I’d like to refactor our Ansible project to improve our use of best practices and include testing with Molecule. We’ve been using Ansible for more than 2 years, and some bad practices have made the project a bit hard to maintain.

We’d like to start by refactoring the biggest role we have in the project that manages the application our company develop. This role currently does everything—installation, deployment, backup, restore, database migrations, user creation, etc.

We’re unsure about how to split this role. Should we really create one role per objective? I’ve read recommendations suggesting roles like `web_app_backup`, `web_app_install`, `web_app_database_migration`, etc., but I’m not fully convinced.

Also, when reading Ansible best practices, the term _idempotence_ comes up a lot. Should the entire project strictly follow idempotence? Only the roles? Is it acceptable (from an Ansible best practice perspective) to have playbooks outside of roles that are not fully idempotent, performing isolated actions that only apply in specific states of the system (e.g., updating a web app)? Or should those playbooks be limited to orchestrating multiple roles instead?

Thanks a lot for your help!
