A collection of classes and commands for automated command line scripting using Python.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1.2 KiB

Templates

Script Tease supports processing of template files using Jinja2.

Location of Templates

By default, the location of template files are reckoned as relative to the steps file.

package_name/
|-- steps.ini
|-- templates
|   `-- httpd.conf

Upon loading the steps.ini file, any reference to a template file is assumed to be in the templates/ directory in the same location.

[create the apache config]
template: httpd.conf /etc/apache2/sites-available/example.app.conf

!!! tip The -T switch of the tease command may be used to add template locations.

Template Context

The context variables available to parse the template are:

  • Variables received on the command line are included in the context.
  • Variables loaded from a file.
  • Options passed to the loader from the command line are also included.

Additionally, any unrecognized parameters specified in the command are included in the context. For example:

[create the httpd.conf file]
template: httpd.conf /etc/apache/sites-available/example.com.conf
ssl_enabled: yes

ssl_enabled is not a normal parameter for the template command, so it is included in the context.