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.

44 lines
1.2 KiB

2 years ago
# Templates
Script Tease supports processing of template files using Jinja2.
## Location of Templates
2 years ago
By default, the location of template files are reckoned as relative to the steps file.
2 years ago
```text
package_name/
2 years ago
|-- steps.ini
2 years ago
|-- templates
| `-- httpd.conf
```
2 years ago
Upon loading the `steps.ini` file, any reference to a template file is assumed to be in the `templates/` directory in the same location.
```ini
[create the apache config]
template: httpd.conf /etc/apache2/sites-available/example.app.conf
```
2 years ago
!!! 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:
```ini
[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.