Skip to content

Generate configuration files based on a template (twig/jinja) based on restriction listed in a yaml file

Notifications You must be signed in to change notification settings

Yoda-BZH/templator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Templator is a tool to generate any type of file (configuration file, terraform files, salt files, puppet files, anything you want) with input defined in a yaml file.

Installation

This is a Symfony project.

Please use the installation guide from Symfony

In short:

$ composer install

Templates

Any type of file can be generated.

Place a file in templates/jinja//.. This is the template file. Use twig (jinja) syntax for your template.

Create a file in templates/configs//.yaml . and must be identical to the template.

The first level on the yaml file is vars .

The second level is each twig variable declared in the template.

The third levels are :

  • type. The variable types. This field is mandatory. Currently supported types are :
    • int
    • string
    • select
    • password
  • default. The default value for the variable.
  • For selecttype, values is mandatory. It contains the possible choices.
  • The types select, int and string can have a help field that will be displayed as a description below the text input.
  • The type string can be set optional by setting the attribute required to false.

Example :

vars:
  a_string:
    type: string
    default: "default string value"
  an_int:
    type: int
    default: 3.14
    help: "This is a number"
  a_choice:
    type: select
    values:
      - yes
      - no
      - maybe
  a_password:
    type: password
    default: ""
  comment:
    type: string
    default: ""
    required: false
    help: "this is a comment you can add"

Images: Github image provided by http://tholman.com/github-corners/

About

Generate configuration files based on a template (twig/jinja) based on restriction listed in a yaml file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •