Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(plugins): Add arista.avd.batch_template action plugin #2593

Merged

Conversation

ClausHolbechArista
Copy link
Contributor

@ClausHolbechArista ClausHolbechArista commented Mar 3, 2023

Change Summary

Add arista.avd.batch_template action plugin

Component(s) name

arista.avd.batch_template

Proposed changes

Creating batch_template plugin which can template multiple files without use of Ansible loops. The major downside of Ansible loops is that they are single-process, so all templating happens in serial. In batch_template we perform the templating in forks (respecting ansible_forks value).

module: batch_template
version_added: "4.0.0"
author: Arista Ansible Team (@aristanetworks)
short_description: Render Jinja2 template on multiple items and write result to individual files.
description:
  - Render Jinja2 template on multiple items and write result to individual files.
options:
  template:
    description: Path to Jinja2 Template file
    required: true
    type: str
  dest_format_string:
    description: Format string used to specify target file for each item. 'item' is the current item from 'items'. Like "mypath/{item}.md"
    required: true
    type: str
  items:
    description: List of strings. Each list item is passed to 'dest_format_string' as 'item' and passed to templater as 'item'
    required: true
    type: list

How to test

Tested offline using schema documentation generation.

Checklist

User Checklist

  • N/A

Repository Checklist

  • My code has been rebased from devel before I start
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation and documentation have been updated accordingly.
  • I have updated molecule CI testing accordingly. (check the box if not applicable)

@ClausHolbechArista ClausHolbechArista requested a review from a team as a code owner March 3, 2023 09:04
@github-actions github-actions bot added role: eos_cli_config_gen issue related to eos_cli_config_gen role role: eos_designs issue related to eos_designs role state: Documentation role Updated type: Python filters labels Mar 3, 2023
@ClausHolbechArista ClausHolbechArista changed the title Batch-templater Feat(plugins): Add arista.avd.batch_template action plugin Mar 3, 2023
Copy link
Contributor

@gmuloc gmuloc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add some section in the README.md for now as well (and yes we shall endeavour to automate this ;) )

@ClausHolbechArista ClausHolbechArista added this to the v4.0.0-dev6 milestone Mar 7, 2023
Copy link
Member

@carlbuchmann carlbuchmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
no tests added since this will be part of schema documentation pre-commit, once we merge this feature.

@carlbuchmann carlbuchmann merged commit 8ac779f into aristanetworks:devel Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants