Skip to content

anta_workflow

Note

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

This module is in preview mode

This module is not guaranteed to have a backwards compatible interface.

Uses ANTA from Ansible

Synopsis

The arista.avd.anta_workflow module is an Ansible Action Plugin to leverage the ANTA test framework to validate that the generated structured configurations by AVD are applied to the devices and that the deployed network is working correctly. It can also be used to execute user-defined ANTA test catalogs in conjunction with the Ansible inventory, providing similar functionality and options as the ANTA CLI while benefiting from Ansible's inventory management capabilities.

The plugin offers the following capabilities:

  • Generating a per-device test catalog based on the AVD structured configuration.
  • Running AVD-generated test catalogs against the devices.
  • Running user-defined test catalogs against the devices.
  • Generating reports in various formats.
  • In dry-run mode, only the test catalogs are generated, and a report is created to preview the tests that would be run against each device.

Parameters

Argument Type Required Default Value Restrictions Description
device_list list True None - List of devices to run ANTA tests against. These devices must be defined in the Ansible inventory.
avd_catalogs dict optional None - AVD-generated test catalogs settings. These settings are used to generate test catalogs based on the AVD structured configurations.
    enabled bool optional True - Enable AVD catalogs generation. Can be disabled if only user-defined catalogs are to be run.
    output_dir str optional None - Directory where the AVD-generated test catalogs will be stored.
    structured_config_dir str optional None - Path to the directory containing the AVD structured configurations per device.
    structured_config_suffix str optional yml Valid values:
- yml
- yaml
- json
File suffix for AVD structured configuration files.
    extra_fabric_validation bool optional False - If true, generate extra fabric-wide validation tests (e.g., reachability and routing tests).
    filters list optional None - Filters used to run or skip tests from the AVD-generated test catalogs. These filters do not apply to user-defined catalogs.
        device_list list optional None - List of devices to apply the filters to.
        run_tests list optional None - List of ANTA tests to only include in the AVD-generated catalogs.
        skip_tests list optional None - List of ANTA tests to exclude from the AVD-generated catalogs. skip_tests takes precedence over run_tests.
user_catalogs dict optional None - User-defined test catalogs settings. These settings are used to run user-provided ANTA catalogs against the devices.
    input_dir str optional None - Directory containing the user-defined ANTA test catalogs.
runner dict optional None - ANTA runner settings. These settings change the behavior of the ANTA runner.
    timeout float optional 30.0 - Global timeout in seconds for API calls to the devices. Can be adjusted depending on the amount of devices and tests.
    batch_size int optional 5 - Number of devices to run per ANTA instance. This can be increased based on the available resources of the Ansible runner.
    tags any optional None - List of tags used with user-defined catalogs to filter which tests to run on which devices.
These tags are used in conjunction with anta_tags variable assigned to devices in the Ansible inventory.
    dry_run bool optional False - Run ANTA in dry-run mode. In this mode, only the test catalogs are generated,
and a report is created to preview the tests that would be run against each device.
report dict optional None - ANTA report settings. These settings define the output format and location of the ANTA reports.
    csv_output str optional None - Path to the CSV report file.
    md_output str optional None - Path to the Markdown report file.
    json_output str optional None - Path to the JSON report file.
    filters dict optional None - Filters used to hide specific test statuses from the reports.
        exclude_statuses list optional None Valid values:
- success
- failure
- error
- skipped
- unset
List of test statuses to exclude from the reports.
    sorting dict optional None - Sorting options to apply to test results.
        status_priority list optional [‘error’, ‘failure’, ‘skipped’, ‘success’, ‘unset’] Valid values:
- error
- failure
- skipped
- success
- unset
List of test statuses that defines the primary grouping order of the test results.
        sort_fields list optional [‘device’, ‘categories’, ‘test’, ‘description’, ‘custom_field’] Valid values:
- categories
- custom_field
- description
- device
- test
List of result attributes used to sort tests within each status group.

See Also

Examples

- name: Run ANTA
  hosts: FABRIC
  connection: local
  gather_facts: false
  tasks:
    - name: Run ANTA workflow
      run_once: true
      delegate_to: localhost
      arista.avd.anta_workflow:
        device_list: "{{ ansible_play_hosts }}"
        avd_catalogs:
          enabled: true
          output_dir: "{{ inventory_dir }}/anta/avd_catalogs"
          structured_config_dir: "{{ inventory_dir }}/intended/structured_configs"
          # structured_config_suffix: ".yml"
          # filters:
          #   - device_list: "{{ groups['DC1'] }}"
          #     skip_tests:
          #       - VerifyNTP
        user_catalogs:
          input_dir: "{{ inventory_dir }}/anta/user_catalogs"
        runner:
          timeout: 360.0
          batch_size: 10
          # tags:
          #   - leaf
          # dry_run: true
        report:
          csv_output: "{{ inventory_dir }}/anta/reports/anta_report.csv"
          md_output: "{{ inventory_dir }}/anta/reports/anta_report.md"
          json_output: "{{ inventory_dir }}/anta/reports/anta_report.json"
          # filters:
          #   hide_statuses:
          #     - success
          #     - skipped

Authors

  • Arista Ansible Team (@aristanetworks)