Playbooks
A playbook is a YAML file describing a list of tasks to run. Each task invokes a module with parameters and an optional with: block of modifiers.
---
- name: Set up a web server
hosts: webservers
tasks:
- !package
name: nginx
state: present
- !template
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
- !service
name: nginx
state: started
enabled: trueTemplating
Playbooks support {{variable}} substitution and conditionals throughout. Variables come from inventory, --extra-vars, facts, and registered task results.
- !file
path: "/home/{{ JET_USERNAME }}/.ssh/authorized_keys"
state: presentValidating playbooks
Before applying a playbook, validate it:
jetpack syntax-check --playbook site.yml
jetpack full-check --playbook site.yml --inventory productionSee Usage for the full set of check modes.
Local bootstrap
jetpack local supports a convention-based bootstrap flow from the current working directory. If you run it from a repository root, Jetpack first checks for ./.jetpack.yml; if absent, it falls back to:
deploy/playbooks/bootstrap.ymldeploy/rolesdeploy/inventory
This lets a bootstrap repo expose a trivial install path:
#!/usr/bin/env bash
set -euo pipefail
jetpack localOptional .jetpack.yml
Override the local bootstrap defaults:
local:
playbook: deploy/playbooks/bootstrap.yml
roles: deploy/roles
inventory: deploy/inventoryPaths resolve relative to the repository root.
Built-in bootstrap variables
When jetpack local runs, Jetpack injects these variables:
JET_CWDJET_AUTOMATION_ROOTJET_PLAYBOOK_DIRJET_ROLES_DIRJET_INVENTORY_DIRJET_USERNAMEJET_USER_HOME(whenHOMEis available)