Skip to content

Latest commit

 

History

History
77 lines (62 loc) · 1.86 KB

README.md

File metadata and controls

77 lines (62 loc) · 1.86 KB

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/