Ansible inventory safeguard.
ansible-pret is a CLI that allows you to register constraints and previous versions of your inventory to analyze and validate upcoming iteration. That way you can
- define lifecycles
- encode business knowledge
- ease code reviews
- improve reliability
and more !
Ansible is not good for decommissioning/rolling back due to its additive behavior.
State machines (paired with descriptive modules) are a great way to tackle this problem, ensuring a variable starts from specific values, same for delete, and can be modified following some rules.
ansible-pret allows one to define such rules and can be used to automatically check each iteration of your inventory complies with them.
Inventory comes with support for groups which can hold variable definitions, transmitted to hosts below (if not overriden).
The association between a given set of groups and variables can be challenging to maintain as inventory evolves and new contributors are onboarded.
Anchors helps ansible-pret reading your inventory and allows one to define constraints limiting in which groups a variable can be defined.
The idea behind this tool is to be integrated inside your CI to check new version of your inventory before integration.