Skip to content

A configuration file creator using Python, PyYaml, Jinja2. Used to quickly create configuration files from templates and user input and or compiled data.

License

Notifications You must be signed in to change notification settings

jacobferrante/configuration_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A tool for creating configuration file using Python, PyYaml, and Jinja2. Used to quickly create configuration files from templates and user input.

You will need to install jinja2 and pyyaml manually.

pip install jinja2
pip install pyyaml

Building Configuration Files

The YAML file contains the questions that needed to be asked to fill in the Jinja2 Template. You will be asked which YAML file to use.

I have added a prereqs section which allows you to predefine settings based on each .yaml file, so far I've added the ability to manual enter a file name, or use one that matches the template name. A option to set the file extension for the completed file, and the output folder location, which leave blank if want to specify during file creation.

Here is an example of the prereqs which would use the template name as the filename, use the file extension .ini and output to the folder "outputs"

prereqs: 
        filename: "server123" # Set predetermined filename 
        file_extension: ".txt" # Set predetermined extension, leave blank if you want none 
        ask_filename: False # If you'd like the script to ask you for a custom filename, make this True
        output_location: test # leave blank if prefer to choose during file creation

These values would ask for an IP address and then assign them to the value. IP

questions:
        # variable to reference in template : "question to ask in script"
        ip_address1: "What is the first IP? "
        ip_address2: "What is the second IP? "
        ip_address3: "What is the third IP? "
        ip_address4: "What is the fourth IP? "

After you've filled in your data through user input, it will ask for a template(s), this is an example on how to format your templates.

ip_address1: {{ ip_address1 }}
ip_address2: {{ ip_address2 }}

About

A configuration file creator using Python, PyYaml, Jinja2. Used to quickly create configuration files from templates and user input and or compiled data.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages