Automation Templates
Bastillefile templates are like Dockerfiles for jails — reproducible automation for any application or service.
A Bastillefile automates the creation and configuration of a container —
the same role a Dockerfile plays in the container world. Templates let you turn
a running jail into a documented, versionable, repeatable recipe: install these
packages, copy these files, enable these services, set these tunables.
Bastille brings the power of industry-leading automation tools — Ansible, Chef, Puppet, SaltStack — without the complexity. The template system deploys a wide range of software and services in minutes, saving time and reducing errors on the path to production.
How a template works
A Bastillefile is a plain-text list of directives, applied top to bottom:
# A minimal web server template
PKG nginx
CP usr /
SYSRC nginx_enable=YES
SERVICE nginx start
RDR tcp 80 80
Common directives include:
| Directive | Does |
|---|---|
PKG | Install binary packages |
CP | Copy files/overlays into the container |
SYSRC | Set rc.conf values safely |
SERVICE | Start, stop, or enable services |
CMD | Run an arbitrary command inside the container |
RDR | Redirect a host port to the container |
SYSCTL | Apply sysctl tunables |
INCLUDE | Compose other templates — stack them together |
Because templates can INCLUDE one another, they’re stackable: build a
hardened base once, then layer application templates on top.
Apply a template
bastille bootstrap https://github.com/BastilleBSD/templates bastille template alcatraz BastilleBSD/nginx
bastille verify will dry-run a template — including its full INCLUDE chain —
before you apply it.
The community collection
Hundreds of ready-to-use templates are maintained in the BastilleBSD/templates repository, validated through CI. A sample of what’s available:
- Web & proxy — Apache, nginx, HAProxy
- Databases — PostgreSQL, MySQL, MariaDB, Elasticsearch
- Languages & runtimes — Python, Rust, Go, PHP, OpenJDK, Node.js
- Apps & platforms — WordPress, Jenkins, Consul, AdGuard Home
- Linux containers — Ubuntu and Debian userlands
Write your own
Any container you can configure by hand, you can capture as a template. The template documentation covers every directive, and the community collection is the best place to learn by example — and to contribute your own.