Skip to content

validate_inputs

Note

Always use the FQCN (Fully Qualified Collection Name) arista.avd.validate_inputs when using this plugin.

Validate variables against AVD schemas

Synopsis

The arista.avd.validate_inputs module is an Ansible Action Plugin designed to validate device variables against Arista AVD schemas.

The plugin performs two phases:

  1. Templating Phase: Resolves Ansible hostvars and writes the templated data as JSON files to the AVD temporary directory. This phase is skipped if input_dir is provided, treating the input files as already templated.
  2. Validation Phase: Validates the inputs against the specified AVD schema using pyavd-utils and writes the validated data as JSON files to the AVD temporary directory.

Parameters

Argument Type Required Default Value Restrictions Description
tmp_dir str True None - Path to use as the AVD temporary directory for storing templated and validated data used internally by plugins.
Must be the same across all plugins.
schema_name str optional avd_design Valid values:
- avd_design
- eos_config
The AVD schema to validate against.
If set to avd_design, the plugin will validate the inputs for the entire fabric (requiring fabric_name to be set).
If set to eos_config, the plugin will validate the inputs for the devices in the current play.
input_dir str False None - Optional path to a directory containing input files to validate directly.
If provided, the templating phase is skipped and files are read from this directory.
Files must be named device_name.input_suffix.
input_suffix str optional json Valid values:
- yml
- yaml
- json
File suffix for files located in input_dir.
Only used when input_dir is provided.
fail_on_validation_errors bool optional False - If true, the task will fail if any validation errors are detected.
If false, errors will be reported but the task will succeed.
batch_size int optional 10 - The number of devices to process per child process during the templating phase.
validation_configuration dict False None - Optional dictionary containing configuration options to control validation behavior.
    warn_eos_config_keys bool optional False - Enable warnings for EOS Config keys used in AVD Design input data.
When enabled, warnings will be emitted during validation if any top-level keys
from the EOS Config schema are found at the top level of AVD Design input data.
vault_id str False None - Vault ID used for encrypting temporary files generated by the plugin.
When Ansible Vault is not configured, this parameter has no effect and files are written as plain JSON.
When Ansible Vault is configured, AVD encrypts files containing templated and validated data
to prevent sensitive information from being exposed in the temporary directories.
* When vault_id is not specified, AVD uses the first Vault ID in the list for encryption.
* When vault_id is specified, AVD uses the specified Vault ID for encryption.

Examples

---
- name: Validate eos_designs inputs for the fabric
  arista.avd.validate_inputs:
    tmp_dir: "{{ output_dir }}/tmp"
    schema_name: avd_design
    fail_on_validation_errors: true

- name: Validate eos_designs inputs with custom validation configuration
  arista.avd.validate_inputs:
    tmp_dir: "{{ output_dir }}/tmp"
    schema_name: avd_design
    fail_on_validation_errors: true
    validation_configuration:
      warn_eos_config_keys: true

- name: Validate eos_cli_config_gen inputs from structured config files
  arista.avd.validate_inputs:
    tmp_dir: "{{ output_dir }}/tmp"
    schema_name: eos_config
    input_dir: "{{ inventory_dir }}/intended/structured_configs"
    input_suffix: "yml"
    fail_on_validation_errors: false

- name: Validate inputs with specific vault identity (when multiple vault identities are configured)
  arista.avd.validate_inputs:
    tmp_dir: "{{ output_dir }}/tmp"
    schema_name: avd_design
    vault_id: prod
    fail_on_validation_errors: true
  # This example assumes vault_identity_list is configured in ansible.cfg:
  # [defaults]
  # vault_identity_list = dev@.vault_dev, prod@.vault_prod
  # The 'prod' vault identity will be used to encrypt temporary files.

Authors

  • Arista Ansible Team (@aristanetworks)