Skip to content

Role configuration for eos_cli_config_gen

Role configuration settings can be set either as regular inventory variables or directly as task_vars on the import_role task.

Role default output directories

Default output directories can be updated by modifying the default role variables:

# Roles Defaults - ouptput directories

# Root directory where to build output structure
root_dir: '{{ inventory_dir }}'

# Documentation folders
# Main documentation folder
documentation_dir_name: 'documentation'
documentation_dir: '{{ root_dir }}/{{ documentation_dir_name }}'

# Device documentation
devices_dir_name: 'devices'
devices_dir: '{{ documentation_dir }}/{{ devices_dir_name }}'

# AVD configurations output
# Main output directory
output_dir_name: 'intended'
output_dir: '{{ root_dir }}/{{ output_dir_name }}'

# Output for structured YAML files:
structured_dir_name: 'structured_configs'
structured_dir: '{{ output_dir }}/{{ structured_dir_name }}'

# EOS Configuration Directory name
eos_config_dir_name: 'configs'
eos_config_dir: '{{ output_dir }}/{{ eos_config_dir_name }}'

# Output directory for AVD temporary files. Defaults to 'intended/tmp'.
avd_tmp_dir: "{{ output_dir }}/tmp"

Tip

You might need the outputs generated by AVD in a different folder than inventory (the default). If updating root_dir, leverage a relative path from inventory_dir to ensure consistent behavior. Example: root_dir: '{{ inventory_dir}}/../outputs'.

Input Variables Validation

Schema validation is performed by the validate_inputs action plugin which is called automatically by the role. The plugin performs variable type conversion and validation of the converted data against the AVD schema.

Any data validation issue will trigger errors - blocking further processing.

Extensibility with Custom Templates

  • Custom templates can be added below the playbook directory.
  • If a location above the directory is desired, a symbolic link can be used.
  • Example under the playbooks directory create symbolic link with the following command:

    ln -s ../../shared_repo/custom_avd_templates/ ./custom_avd_templates
    
  • The output will be rendered at the end of the configuration.
  • The order of custom templates in the list can be important if they overlap.
  • It is recommenended to use a ! delimiter at the top of each custom template.

Tip

The templates will have any host or group variable available to it. If adding custom keys to an existing AVD data model, start the key with an underscore _, so it will be ignored by schema validation.

Variable Type Required Default Value Restrictions Description
custom_templates List, items: String - Custom templates can be added below the playbook directory.
- If a location above the directory is desired, a symbolic link can be used.
- Example under the playbooks directory create symbolic link with the following command:

bash<br> ln -s ../../shared_repo/custom_avd_templates/ ./custom_avd_templates<br>

- The output will be rendered at the end of the configuration.
- The order of custom templates in the list can be important if they overlap.
- It is recommended to use a ! delimiter at the top of each custom template.

Add custom_templates to group/host variables:
  - <str> String Template relative path below playbook directory.
# - Custom templates can be added below the playbook directory.
# - If a location above the directory is desired, a symbolic link can be used.
# - Example under the `playbooks` directory create symbolic link with the following command:
#
#   ```bash
#   ln -s ../../shared_repo/custom_avd_templates/ ./custom_avd_templates
#   ```
#
# - The output will be rendered at the end of the configuration.
# - The order of custom templates in the list can be important if they overlap.
# - It is recommended to use a `!` delimiter at the top of each custom template.
#
# Add `custom_templates` to group/host variables:
custom_templates:

    # Template relative path below playbook directory.
  - <str>

Generation of device configuration and documentation

The following settings can be leveraged to control generation of device configuration and documentation.

Variable Type Required Default Value Restrictions Description
avd_structured_config_file_format String yml Valid Values:
- yml
- yaml
- json
The file format to use when loading structured configuration files.
avd_tmp_dir String Path for the AVD temporary directory.
Contains templated inputs, validated inputs, and facts data used internally by AVD plugins.
Defaults to ‘intended/tmp’. The temporary directory is cleaned up at the end of each role.
avd_vault_id String Vault ID used for encrypting temporary files generated by the role.
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 avd_vault_id is not specified, AVD uses the first Vault ID in the list for encryption.
* When avd_vault_id is specified, AVD uses the specified Vault ID for encryption.
eos_cli_config_gen_configuration Dictionary
  enable Boolean True Generate device EOS configurations.
  hide_passwords Boolean False Replace the input data using the hide_passwords filter in the Jinja2 templates by ‘’ in the configuration if true.
eos_cli_config_gen_documentation Dictionary
  enable Boolean True Generate device Markdown documentation.
  hide_passwords Boolean True Replace the input data using the hide_passwords filter in the Jinja2 templates by ‘’ in the documentation if true.
  toc Boolean True Generate the table of content(TOC) on device documentation.
eos_cli_config_gen_validate_inputs_batch_size Integer 10 The number of hosts to process in each batch when validating inputs.
Depending on your inventory size and the available resources, you may want to adjust this number.
generate_default_config removed Boolean False This key was removed. Support was removed in AVD version 6.0.0. See here for details.
generate_device_documentation removed Boolean True This key was removed. Support was removed in AVD version 6.0.0. Use eos_cli_config_gen_documentation.enable instead.
read_structured_config_from_file Boolean True Read structured configuration from files in structured_dir (default directory also used by the eos_designs role).
If set to false, eos_cli_config_gen will read structured configuration from hostvars.
# The file format to use when loading structured configuration files.
avd_structured_config_file_format: <str; "yml" | "yaml" | "json"; default="yml">

# Path for the AVD temporary directory.
# Contains templated inputs, validated inputs, and facts data used internally by AVD plugins.
# Defaults to 'intended/tmp'. The temporary directory is cleaned up at the end of each role.
avd_tmp_dir: <str>

# Vault ID used for encrypting temporary files generated by the role.
# 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 `avd_vault_id` is not specified, AVD uses the *first* Vault ID in the list for encryption.
#   * When `avd_vault_id` is specified, AVD uses the specified Vault ID for encryption.
avd_vault_id: <str>
eos_cli_config_gen_configuration:

  # Generate device EOS configurations.
  enable: <bool; default=True>

  # Replace the input data using the `hide_passwords` filter in the Jinja2 templates by '<removed>' in the configuration if true.
  hide_passwords: <bool; default=False>
eos_cli_config_gen_documentation:

  # Generate device Markdown documentation.
  enable: <bool; default=True>

  # Replace the input data using the `hide_passwords` filter in the Jinja2 templates by '<removed>' in the documentation if true.
  hide_passwords: <bool; default=True>

  # Generate the table of content(TOC) on device documentation.
  toc: <bool; default=True>

# The number of hosts to process in each batch when validating inputs.
# Depending on your inventory size and the available resources, you may want to adjust this number.
eos_cli_config_gen_validate_inputs_batch_size: <int; default=10>

# Read structured configuration from files in `structured_dir` (default directory also used by the `eos_designs` role).
# If set to false, `eos_cli_config_gen` will read structured configuration from hostvars.
read_structured_config_from_file: <bool; default=True>