GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - silvascafe/pytemplate: A python2 program to emulate Ansible's template module

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
filter_plugins
filter_plugins
 
 
host_vars
host_vars
 
 
templates
templates
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
ansible-ipaddr.md
ansible-ipaddr.md
 
 
pytemplate.py
pytemplate.py
 
 
pytemplate.pyc
pytemplate.pyc
 
 
test.py
test.py
 
 

Repository files navigation

Simple PyTemplate

Simple PyTemplate is a script build in Python 2.7 to emulate Ansible's template module.

Required Software

pip install netaddr, jinja2

Getting Started

Move to local directory containing template source code

From the python console, run:

> python2
>>import pytemplate
>>newtemplate = pytemplate.module_mode('vlans.j2', ('common.yml','n0-access-a.yml'))
>>print str(newtemplate)

hostname n0-access-a
interface vlan 100
    description data vlan
    ip 192.168.1.1
    mask 255.255.255.0

From the terminal, run:

>python pytemplate.py -h
usage: pytemplate.py [-h] template [yamls [yamls ...]]

Emulate Ansible's Template module

positional arguments:
  template    Jinja2 filaname in ./templates (required)
  yamls       YAML filename(s) in ./host_vars (required)

optional arguments:
  -h, --help  show this help message and exit


>python2 pytemplate.py vlans.j2 common.yml n0-access-a.yml

hostname n0-access-a
interface vlan 100
    description data vlan
    ip 192.168.1.1
    mask 255.255.255.0

About

A python2 program to emulate Ansible's template module

Resources

Readme
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.