ansible-template-render

module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: MIT

README

ansible-template-render

A tool for rendering Ansible template files locally without applying changes to remote hosts.

Overview

ansible-template-render allows you to preview configuration files that would be generated by Ansible playbooks without actually deploying them to the target servers. This is useful for verifying configuration templates before deployment.

Features

  • Generate configuration files from Ansible templates locally
  • Process playbooks with dependencies
  • Respect variable precedence in Ansible
  • Render templates with the same variable context that would be used in actual deployment
  • Support both static and dynamic inventory
  • Option to generate files without executing Ansible

Prerequisites

Ansible

Usage

ansible-template-render run      [-i INV] PLAYBOOK [-- ANSIBLE_ARGS...]
ansible-template-render generate [-i INV] PLAYBOOK [-- ANSIBLE_ARGS...]
ansible-template-render version
  • run — render templates by invoking ansible-playbook
  • generate — produce the modified Ansible files without executing
  • Arguments after -- are passed through to ansible-playbook

How It Works

  1. The tool analyzes the specified playbook to find template tasks
  2. It creates a temporary directory with a modified version of the playbook and roles
  3. Template tasks are modified to:
    • Add delegate_to: localhost and run_once: true
    • Add a render_config tag
    • Redirect output to the local output directory
  4. Ansible is executed with only the render_config tag enabled
  5. The resulting files are generated in the output directory

Examples

An example project is available in the example/ directory:

$ ansible-template-render run -i inventory site.yml

Pass extra flags to ansible-playbook:

$ ansible-template-render run -i inventory site.yml -- --diff

Generate without executing:

$ ansible-template-render generate -i inventory site.yml

License

This project is licensed under the MIT License.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL