ansible.utils.validate – Validate data with provided criteria¶
Note
This plugin is part of the ansible.utils collection (version 2.0.2).
To install it use: ansible-galaxy collection install ansible.utils
.
To use it in a playbook, specify: ansible.utils.validate
.
New in version 1.0.0: of ansible.utils
Synopsis¶
Validate data with provided criteria based on the validation engine.
Note
This module has a corresponding action plugin.
Parameters¶
Notes¶
Note
For the type of options data and criteria refer to the individual validate plugin documentation that is represented in the value of engine option.
For additional plugin configuration options refer to the individual validate plugin documentation that is represented by the value of engine option.
The plugin configuration option can be either passed as task or environment variables.
The precedence of the validate plugin configurable option is task variables followed by the environment variables.
Examples¶
- name: set facts for data and criteria
ansible.builtin.set_fact:
data: "{{ lookup('ansible.builtin.file', './validate/data/show_interfaces_iosxr.json')}}"
criteria: "{{ lookup('ansible.builtin.file', './validate/criteria/jsonschema/show_interfaces_iosxr.json')}}"
- name: validate data in with jsonschema engine (by passing task vars as configurable plugin options)
ansible.utils.validate:
data: "{{ data }}"
criteria: "{{ criteria }}"
engine: ansible.utils.jsonschema
vars:
ansible_jsonschema_draft: draft7
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Bradley Thornton (@cidrblock)
Ganesh Nalawade (@ganeshrn)