Closed NilashishC closed 3 months ago
I think it should implement as a sub-plugin of validate
plugin
For example:
- hosts: sw01
gather_facts: no
tasks:
- name: Validate candidate config against a pre-defined set of rules
ansible.utils.validate:
data: "{{ lookup('file', 'candidate.cfg') }}"
engine: "ansible.netcommon.native_validator". # name subject to bikeshedding :-)
criteria:
- "{{ role_path }}/rules/rules.yaml"
Proposal:
Add support for a config validation plugin that evaluates network configurations against a predefined set of rules and renders warnings/failures based on the outcome of the validation task. This is aimed to precede
*_config
tasks in a playbook and would allow us to catch potential errors in the candidate config before the succeeding tasks make configuration changes on the target. The rule set(s) are expected to be implemented by the users based on their exact needs and target platforms.Motivation
Describe the reasons for this proposal. Have the ability to determine the "correctness" of the configuration to be pushed and ensure a more predictable outcome from the *_config modules.
Problems
As a user of the *_config modules:
Solution proposal
Playbook:
candidate.cfg:
rules.yaml:
Result: