# Spec reference

A spec is the short document that describes the image you want: the operating system, how it is hardened, what is installed and written on it, the services it runs, and where its servers run. Tarsana builds the image from the spec and nothing else, so the same spec always gives the same image.

You write a spec in YAML or JSON; the two say the same thing. This page has the smallest spec Tarsana accepts, recipes for what most images need, how to check a spec before you submit it, and every field a spec can have.

Every spec on this page is checked when this site is built: it is read and validated exactly as Tarsana reads and validates yours.

## The smallest spec {#minimal}

These five lines are a complete spec. Every spec needs them.

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
policy_class: baseline
```

- `schema_version: "2.0"` says which version of the spec language you write. Keep the quotes: without them, YAML reads `2.0` as a number.
- `distro: ubuntu` is the Linux distribution the image is built from.
- `snapshot_id: "20260715T000000Z"` is the fixed package snapshot every package comes from, so the same spec always gets the same packages. Keep the quotes.
- `base_ref: noble` is the release of that distribution: `noble` is Ubuntu 24.04.
- `policy_class: baseline` is the set of rules your image is checked against before it is signed.

The image it describes is plain Ubuntu 24.04: nothing extra installed and no hardening, because [`hardening_profile`](#field-hardening-profile) is `none` unless you set it. The recipes below start from the same five lines and add `hardening_profile: tarsana-baseline`.

## The smallest spec a server boots {#minimal-bootable}

A server that installs the image on its own disk and boots it needs a kernel and the tools it boots with, and, to be kept up to date by Tarsana, what the update agent needs on the server. This is the `bootable-node` spec that [Run it on your provider](/quickstarts/run-on-your-provider) builds. Its package list is already reviewed, and every build of it is checked against that list as long as you change only `metadata` (your own tenant ID) and, if you like, `placement`. If you change more, your build gets its own list: see [How your packages are approved](#package-approval).

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
hardening_profile: tarsana-baseline
policy_class: baseline
packages:
  - linux-image-virtual
  - initramfs-tools
  - cryptsetup-bin
  - systemd-sysv
  - curl
  - dmsetup
files:
  - path: /etc/fstab
    mode: "0644"
    content: |
      /dev/mapper/tarsana-root  /  ext4  ro  0  1
      LABEL=tarsana-state  /var/lib/tarsana-state  ext4  rw,nosuid,nodev,noexec,nofail  0  2
  - path: /usr/local/sbin/tarsana-boot-ok
    mode: "0755"
    content: |
      #!/bin/sh
      # Tarsana: the OS health assertion -- what the chooser's tries-left counter waits for.
      # Owner: Q3 (boot/CONTRACT.md §4, boot/os/; X330, D75 Q3 = 3B, X250 §4).
      # Installed as /usr/local/sbin/tarsana-boot-ok by specs/roles/{worker,control}.yaml (boot/os/MANIFEST).
      #
      # Writes boot_ok=1 and boot_pending=0 on the state partition -- exactly those two markers and
      # nothing else (CONTRACT §6.1) -- when ALL of these hold:
      #   state   the state partition is mounted at /var/lib/tarsana-state (where the markers live);
      #   verity  root IS the dm-verity device tarsana-root, the kernel reports it verified, and its
      #           root hash is the one the chooser put on the command line (tarsana.verity_roothash=);
      #   units   every unit /etc/tarsana/boot-required.services names is active (D64 §6: the SPEC is
      #           the authority on whether a boot is ok). The role specs name the update agent there:
      #           a node that boots but can never be updated again has no remote remedy. An absent list
      #           is REFUSED, never read as an empty one;
      #   ident   the node identity the agent uses is held: client.crt and client.key on the state
      #           partition parse and belong together.
      # Nothing here depends on the network being up now: an assertion that did would roll healthy nodes
      # back during an image-server outage, fleet-wide (X250 §4).
      #
      # Then the boot deadline is disarmed (tarsana-boot-watchdog disarm). When the checks have not all
      # passed after BOOT_OK_WAIT seconds, NOTHING is written: stage-1 has already counted this boot, and
      # the armed deadline reboots the node into the chooser, which counts the next one.
      # Exit: 0 asserted; 1 not asserted (the reasons are on stdout and in the journal).
      set -u
      S=/var/lib/tarsana-state
      REQUIRED=/etc/tarsana/boot-required.services
      VERITY_NAME=tarsana-root
      BOOT_OK_WAIT=120

      say() { echo "[tarsana] boot_ok: $*"; }

      check_state() {
        mountpoint -q "$S" || { WHY="state partition not mounted at $S"; return 1; }
      }

      check_verity() {
        want=""
        # shellcheck disable=SC2013  # the command line is words
        for tok in $(cat /proc/cmdline); do
          case "$tok" in tarsana.verity_roothash=*) want="${tok#tarsana.verity_roothash=}" ;; esac
        done
        [ -n "$want" ] || { WHY="no tarsana.verity_roothash on the command line: booted without verity"; return 1; }
        src="$(findmnt -no SOURCE / 2>/dev/null)"
        [ "$src" = "/dev/mapper/$VERITY_NAME" ] || { WHY="root is '${src:-?}', not /dev/mapper/$VERITY_NAME"; return 1; }
        if command -v veritysetup >/dev/null 2>&1; then
          st="$(veritysetup status "$VERITY_NAME" 2>/dev/null)" || { WHY="veritysetup status $VERITY_NAME failed"; return 1; }
          vstatus="$(printf '%s\n' "$st" | sed -n 's/^ *status: *//p' | head -1)"
          have="$(printf '%s\n' "$st" | sed -n 's/^ *root hash: *//p' | head -1 | tr 'A-F' 'a-f')"
        else
          # X334: the factory removes veritysetup from every image's root (stages/build/lib/boot.sh,
          # boot_purge_veritysetup), so on a factory image the kernel's own table is read with dmsetup:
          #   table   0 <len> verity <ver> <data> <hash> <dbs> <hbs> <blocks> <hash start> <alg> <ROOT> <salt> ...
          #   status  0 <len> verity V (verified) | C (corruption detected)
          command -v dmsetup >/dev/null 2>&1 || { WHY="neither veritysetup nor dmsetup is in this image"; return 1; }
          tbl="$(dmsetup table "$VERITY_NAME" 2>/dev/null)" || { WHY="dmsetup table $VERITY_NAME failed"; return 1; }
          dst="$(dmsetup status "$VERITY_NAME" 2>/dev/null)" || { WHY="dmsetup status $VERITY_NAME failed"; return 1; }
          # shellcheck disable=SC2086  # the table and the status are words
          set -- $tbl
          if [ "${3:-}" != verity ] || [ "$#" -lt 13 ]; then WHY="$VERITY_NAME is not a dm-verity table ('${3:-?}')"; return 1; fi
          have="$(printf '%s' "${12}" | tr 'A-F' 'a-f')"
          # shellcheck disable=SC2086
          set -- $dst
          case "${3:-}:${4:-}" in
            verity:V) vstatus=verified ;;
            verity:C) vstatus=corrupted ;;
            *) vstatus="${3:-}:${4:-}" ;;
          esac
        fi
        case "$vstatus" in verified*) ;; *) WHY="verity status is '${vstatus:-?}', not verified"; return 1 ;; esac
        want="$(printf '%s' "$want" | tr 'A-F' 'a-f')"
        if [ -z "$have" ] || [ "$have" != "$want" ]; then
          WHY="running root hash '${have:-?}' is not the command line's '$want'"; return 1
        fi
      }

      check_units() {
        [ -f "$REQUIRED" ] || { WHY="$REQUIRED is absent: cannot tell which units the spec requires"; return 1; }
        [ -r "$REQUIRED" ] || { WHY="$REQUIRED is unreadable"; return 1; }
        down=""
        while IFS= read -r unit || [ -n "$unit" ]; do
          case "$unit" in ''|'#'*) continue ;; esac
          ustate="$(systemctl is-active "$unit" 2>/dev/null)"
          [ "$ustate" = active ] || down="$down $unit=${ustate:-unknown}"
        done < "$REQUIRED"
        [ -z "$down" ] || { WHY="required units not active:$down"; return 1; }
      }

      check_ident() {
        crt="$S/tarsana/pki/client.crt"; key="$S/tarsana/pki/client.key"
        a="$(openssl x509 -in "$crt" -noout -pubkey 2>/dev/null)" || { WHY="node identity $crt does not parse"; return 1; }
        b="$(openssl pkey -in "$key" -pubout 2>/dev/null)" || { WHY="node identity $key does not parse"; return 1; }
        if [ -z "$a" ] || [ "$a" != "$b" ]; then WHY="node identity: $key is not the key of $crt"; return 1; fi
      }

      waited=0
      while :; do
        WHY=""
        if check_state && check_verity && check_units && check_ident; then break; fi
        if [ "$waited" -ge "$BOOT_OK_WAIT" ]; then
          say "NOT asserted after ${waited}s: $WHY"
          say "nothing written; the boot deadline brings this node back to the chooser, which counts it"
          exit 1
        fi
        sleep 2; waited=$((waited + 2))
      done

      mkdir -p "$S/tarsana"
      printf 1 > "$S/tarsana/boot_ok"
      printf 0 > "$S/tarsana/boot_pending"
      sync
      say "asserted after ${waited}s (state, verity, units, identity): boot_ok=1 on $S"
      /usr/local/sbin/tarsana-boot-watchdog disarm || say "the boot deadline could not be disarmed (see above)"
      exit 0
  - path: /etc/systemd/system/tarsana-boot-ok.service
    mode: "0644"
    content: |
      [Unit]
      Description=Tarsana: OS health assertion -- boot_ok for the chooser's tries-left counter (X330)
      RequiresMountsFor=/var/lib/tarsana-state
      # X334: NO After=multi-user.target. The target Wants this unit (50-tarsana-boot-ok.conf), so it is
      # already ordered After= it by default; the two together are an ordering cycle and systemd breaks it
      # by deleting this unit's start job (measured under KVM: the assertion never ran). The script waits
      # up to BOOT_OK_WAIT for the units it checks, so it needs no ordering of its own.
      [Service]
      Type=oneshot
      ExecStart=/usr/local/sbin/tarsana-boot-ok
      RemainAfterExit=yes
      [Install]
      WantedBy=multi-user.target
  - path: /etc/systemd/system/multi-user.target.d/50-tarsana-boot-ok.conf
    mode: "0644"
    content: |
      # X330: pulls the OS health assertion into every boot. A drop-in, because the spec path writes
      # files and enables no node unit (its [Install] section alone would never run it).
      [Unit]
      Wants=tarsana-boot-ok.service
  - path: /etc/tarsana/boot-required.services
    mode: "0644"
    content: |
      # Units that must be active for this OS to assert boot_ok (D64 §6: the spec is the authority).
      # Read by /usr/local/sbin/tarsana-boot-ok. The update agent (Q2's boot/agent/agent.sh): a node that
      # boots but can never be updated again has no remote remedy (X250 §4 (b)).
      tarsana-agent.service
  - path: /usr/local/sbin/tarsana-boot-watchdog
    mode: "0755"
    content: |
      #!/bin/sh
      # Tarsana: the boot deadline -- softdog armed early, until the OS health assertion disarms it.
      # Owner: Q3 (boot/CONTRACT.md §4, boot/os/; X330, D75 Q3 = 3B with 3C's softdog, X250 §4).
      # Installed as /usr/local/sbin/tarsana-boot-watchdog by specs/roles/{worker,control}.yaml.
      #
      #     tarsana-boot-watchdog arm      # tarsana-boot-watchdog.service, before sysinit.target
      #     tarsana-boot-watchdog disarm   # tarsana-boot-ok, once it has written boot_ok=1
      #
      # panic= brings a PANICKING kernel back to the chooser; nothing brings back a userspace that
      # hangs before the assertion. So the watchdog is opened and closed WITHOUT the magic 'V': it keeps
      # running, nobody feeds it, and BOOT_DEADLINE seconds later it reboots the node into the chooser,
      # which counts the boot (tries_left_<S>). The assertion stops it with the magic close and puts
      # back the device's own timeout, so whatever uses the watchdog later (medik8s self-node-remediation
      # on the role images) finds it as it was.
      # Never arms a deadline it could not take back: with nowayout set, magic close cannot stop it,
      # and every HEALTHY node would reboot every BOOT_DEADLINE seconds. Exit 0 always -- a boot is
      # never held up by this script; what it could not do it says.
      set -u
      DEV=/dev/watchdog
      SYS=/sys/class/watchdog/watchdog0
      SAVE=/run/tarsana-boot-watchdog.timeout
      BOOT_DEADLINE=900

      say() { echo "[tarsana] boot deadline: $*"; }

      arm() {
        [ -c "$DEV" ] || modprobe softdog 2>/dev/null
        n=0
        while [ ! -c "$DEV" ] && [ "$n" -lt 5 ]; do sleep 1; n=$((n + 1)); done
        [ -c "$DEV" ] || { say "NOT armed: no $DEV (softdog did not load)"; return 0; }
        nwo="$(cat "$SYS/nowayout" 2>/dev/null)"
        [ "$nwo" = 0 ] || { say "NOT armed: nowayout is '${nwo:-unreadable}', a deadline that cannot be stopped would reboot healthy nodes"; return 0; }
        cat "$SYS/timeout" > "$SAVE" 2>/dev/null || :
        wdctl -s "$BOOT_DEADLINE" "$DEV" >/dev/null 2>&1 || { say "NOT armed: wdctl could not set ${BOOT_DEADLINE}s on $DEV"; return 0; }
        # open and close without 'V': the watchdog stays running and nobody feeds it
        if ! true 2>/dev/null > "$DEV"; then say "NOT armed: cannot open $DEV"; return 0; fi
        say "armed: ${BOOT_DEADLINE}s on $DEV ($(cat "$SYS/identity" 2>/dev/null)), state $(cat "$SYS/state" 2>/dev/null)"
      }

      disarm() {
        [ -c "$DEV" ] || { say "nothing to disarm: no $DEV"; return 0; }
        # magic close: open, 'V', close -> stopped (nowayout was checked when it was armed)
        if ! printf V 2>/dev/null > "$DEV"; then say "could NOT disarm: $DEV is busy or unwritable"; return 0; fi
        orig="$(cat "$SAVE" 2>/dev/null)"
        if [ -n "$orig" ]; then wdctl -s "$orig" "$DEV" >/dev/null 2>&1 || say "could not restore the timeout to ${orig}s"; fi
        say "disarmed, state $(cat "$SYS/state" 2>/dev/null)"
      }

      case "${1:-}" in
        arm) arm ;;
        disarm) disarm ;;
        *) echo "usage: $0 arm|disarm" >&2; exit 2 ;;
      esac
      exit 0
  - path: /etc/systemd/system/tarsana-boot-watchdog.service
    mode: "0644"
    content: |
      [Unit]
      Description=Tarsana: boot deadline -- softdog armed until the OS health assertion (X330)
      DefaultDependencies=no
      After=systemd-modules-load.service
      Before=sysinit.target shutdown.target
      Conflicts=shutdown.target
      [Service]
      Type=oneshot
      ExecStart=/usr/local/sbin/tarsana-boot-watchdog arm
      ExecStop=/usr/local/sbin/tarsana-boot-watchdog disarm
      RemainAfterExit=yes
      [Install]
      WantedBy=sysinit.target
  - path: /etc/systemd/system/sysinit.target.d/50-tarsana-boot-watchdog.conf
    mode: "0644"
    content: |
      # X330: pulls the boot deadline into every boot, before sysinit.target. A drop-in, because the
      # spec path writes files and enables no node unit.
      [Unit]
      Wants=tarsana-boot-watchdog.service
  - path: /usr/lib/sysctl.d/90-tarsana-panic.conf
    mode: "0644"
    content: |
      # X330: the image's own copy of PANIC_ARGS (boot/stage1/lib/panic.sh), so a panic, an oops or a
      # soft lockup reboots into the chooser even if a command line lost them. Shipped in the VENDOR
      # directory /usr/lib/sysctl.d: /etc/sysctl.d/ is the hardening layer's (content/layers/reserved-paths.tsv),
      # and a node layer writing there is refused at assembly (X334).
      kernel.panic = 10
      kernel.panic_on_oops = 1
      kernel.softlockup_panic = 1
  - path: /usr/local/sbin/tarsana-node-network
    mode: "0755"
    content: |
      #!/bin/sh
      # Tarsana: the OS's network, as route 3's takeover captured it -- so the update agent can fetch and
      # report from the running OS (X418, F-526). Installed as /usr/local/sbin/tarsana-node-network by
      # specs/examples/bootable-node.yaml (content/os-network/MANIFEST).
      #
      # Stage-1 (X333, boot/stage1/lib/net.sh) keeps the network the install script captured from the
      # provider's stock OS on the state partition, and brings it up itself at every boot:
      #   tarsana/net/mac    the NIC, by MAC                 tarsana/node_cidr   its address, a.b.c.d/n
      #   tarsana/node_gw    the gateway (may be off-prefix) tarsana/net/dns     a,b,... (may be absent)
      # These are the values nodecfg_captured_netplan renders as netplan for an OS that carries netplan.io;
      # this OS does not (netplan.io would bring python3 into a minimal image), so they are rendered here
      # for systemd-networkd, which is in the image's own systemd:
      #   /run/systemd/network/10-tarsana-node.network   the address on the NIC with that MAC, and the
      #                                                  default route through the gateway ON-LINK (Hetzner
      #                                                  Cloud hands out a /32 whose gateway sits outside it)
      #   /run/tarsana-net/resolv.conf                   the captured resolvers, bind-mounted over
      #                                                  /etc/resolv.conf (the root is read-only)
      # p4 is OS-writable, so every value is checked for its shape first and NOTHING is written from a
      # value that is not one; a node without a captured network gets none (the chain's own network is
      # stage-1's, not this OS's). Nothing here is a security boundary: what the agent fetches is
      # verified, and the transport's CA comes from stage-1 (content/agent/tarsana-agent).
      #
      # Exit: 0 written; 1 not written (the reason is on stdout and in the journal).
      set -u
      S="${TARSANA_NET_STATE:-/var/lib/tarsana-state}"
      NETWORK_DIR="${TARSANA_NET_NETWORKD:-/run/systemd/network}"
      RUN="${TARSANA_NET_RUN:-/run/tarsana-net}"
      RESOLV="${TARSANA_NET_RESOLV:-/etc/resolv.conf}"
      UNIT=10-tarsana-node.network

      say() { echo "[tarsana] node network: $*"; }
      refuse() { say "NOT configured: $*"; exit 1; }

      # An IPv4 address in dotted quad, every octet 0-255 and written without a leading zero.
      ipv4() {
        case "$1" in ''|*[!0-9.]*|.*|*.|*..*) return 1 ;; esac
        _ip_old=$IFS; IFS=.
        # shellcheck disable=SC2086  # the address is split into its octets on purpose
        set -- $1
        IFS=$_ip_old
        [ "$#" -eq 4 ] || return 1
        for _ip_o in "$@"; do
          case "$_ip_o" in 0) ;; 0*|????*) return 1 ;; esac
          [ "$_ip_o" -le 255 ] || return 1
        done
      }

      value() { cat "$S/tarsana/$1" 2>/dev/null; }

      mountpoint -q "$S" || refuse "the state partition is not mounted at $S"
      MAC="$(value net/mac)"; CIDR="$(value node_cidr)"; GW="$(value node_gw)"; DNS="$(value net/dns)"
      if [ -z "$MAC" ] || [ -z "$CIDR" ]; then
        refuse "no captured network on the state partition (tarsana/net/mac, tarsana/node_cidr): this node was not enrolled by a takeover"
      fi
      case "$MAC" in
        [0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]) ;;
        *) refuse "tarsana/net/mac is not a MAC address" ;;
      esac
      case "$CIDR" in */*/*|*/) refuse "tarsana/node_cidr is not an address/prefix" ;; esac
      PREFIX="${CIDR#*/}"
      case "$CIDR:$PREFIX" in
        */*:[0-9]|*/*:[12][0-9]|*/*:3[0-2]) ;;
        *) refuse "tarsana/node_cidr is not an address/prefix" ;;
      esac
      ipv4 "${CIDR%/*}" || refuse "tarsana/node_cidr is not an IPv4 address/prefix"
      [ -z "$GW" ] || ipv4 "$GW" || refuse "tarsana/node_gw is not an IPv4 address"
      NS=""
      if [ -n "$DNS" ]; then
        case "$DNS" in *[!0-9.,]*) refuse "tarsana/net/dns is not a list of IPv4 addresses" ;; esac
        _old=$IFS; IFS=,
        for _d in $DNS; do
          ipv4 "$_d" || { IFS=$_old; refuse "tarsana/net/dns is not a list of IPv4 addresses"; }
          NS="$NS $_d"
        done
        IFS=$_old
      fi

      mkdir -p "$NETWORK_DIR" "$RUN" || refuse "cannot make $NETWORK_DIR or $RUN"
      {
        echo "# Written at boot by /usr/local/sbin/tarsana-node-network from the state partition (X418)."
        echo "[Match]"
        echo "MACAddress=$MAC"
        echo "[Network]"
        echo "Address=$CIDR"
        if [ -n "$GW" ]; then
          echo "[Route]"
          echo "Gateway=$GW"
          echo "GatewayOnLink=yes"
        fi
      } > "$NETWORK_DIR/$UNIT.new" || refuse "cannot write $NETWORK_DIR/$UNIT"
      mv "$NETWORK_DIR/$UNIT.new" "$NETWORK_DIR/$UNIT" || refuse "cannot write $NETWORK_DIR/$UNIT"
      say "$MAC: $CIDR, gateway ${GW:-<none>} -> $NETWORK_DIR/$UNIT"

      if [ -n "$NS" ]; then
        # Rewritten in place, never replaced: a bind mount holds the inode it was made on.
        : > "$RUN/resolv.conf" || refuse "cannot write $RUN/resolv.conf"
        for _d in $NS; do echo "nameserver $_d" >> "$RUN/resolv.conf"; done
        chmod 644 "$RUN/resolv.conf"
        if [ -z "$(findmnt -rn -o TARGET --mountpoint "$RESOLV" 2>/dev/null)" ]; then
          mount --bind "$RUN/resolv.conf" "$RESOLV" || refuse "cannot bind $RUN/resolv.conf over $RESOLV"
        fi
        say "resolvers:$NS -> $RESOLV"
      else
        say "no captured resolvers: $RESOLV is left as the image has it"
      fi
      # systemd-networkd normally starts after this unit and reads the file then; one already running
      # is told to read it again.
      if systemctl -q is-active systemd-networkd.service 2>/dev/null; then networkctl reload 2>/dev/null || :; fi
      exit 0
  - path: /etc/systemd/system/tarsana-node-network.service
    mode: "0644"
    content: |
      [Unit]
      Description=Tarsana: the OS network as route 3's takeover captured it on the state partition (X418)
      # Before systemd-networkd reads its configuration, after the state partition is mounted.
      DefaultDependencies=no
      RequiresMountsFor=/var/lib/tarsana-state
      After=local-fs.target
      Before=systemd-networkd.service network-pre.target shutdown.target
      Wants=network-pre.target
      Conflicts=shutdown.target
      [Service]
      Type=oneshot
      ExecStart=/usr/local/sbin/tarsana-node-network
      RemainAfterExit=yes
      [Install]
      WantedBy=multi-user.target
  - path: /etc/systemd/system/multi-user.target.d/50-tarsana-node-network.conf
    mode: "0644"
    content: |
      # X418: pulls the OS network into every boot -- the captured network, then systemd-networkd, which
      # brings it up. A drop-in, because the spec path writes files and enables no node unit (F-326).
      [Unit]
      Wants=tarsana-node-network.service systemd-networkd.service
  - path: /etc/systemd/system/network-online.target.d/50-tarsana-network-online.conf
    mode: "0644"
    content: |
      # X418: network-online.target, which the update agent's run waits for, means the captured network
      # is up (systemd-networkd-wait-online), not merely that systemd-networkd has started.
      [Unit]
      Wants=systemd-networkd-wait-online.service
      After=systemd-networkd-wait-online.service
placement:
  provider: hetzner-cloud
  server_type: cpx12
```

- `schema_version: "2.0"` as in the smallest spec.
- `distro: ubuntu` as in the smallest spec.
- `snapshot_id: "20260715T000000Z"` as in the smallest spec.
- `base_ref: noble` as in the smallest spec.
- `hardening_profile: tarsana-baseline` hardens the image with Tarsana's own baseline.
- `policy_class: baseline` as in the smallest spec.
- `packages:` adds the packages a server needs to boot the image itself and to keep it up to date:
- `- linux-image-virtual` is the kernel and its modules.
- `- initramfs-tools` builds the initial RAM disk the kernel starts from.
- `- cryptsetup-bin` checks the image's integrity while it boots.
- `- systemd-sysv` starts the system.
- `- curl` is how Tarsana's update agent on the server fetches updates and reports back.
- `- dmsetup` lets the server check at every boot that it runs the image exactly as it was signed.
- `files:` adds the files Tarsana's update agent needs on the server. Keep them as they are:
- `- path: /etc/fstab` mounts the server's own data partition, where it keeps its identity and its update state. The rest of the image stays read-only.
- `mode: "0644"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /usr/local/sbin/tarsana-boot-ok` checks after every boot that the server is healthy, and tells the boot loader so. An update whose boots never pass this check is rolled back.
- `mode: "0755"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /etc/systemd/system/tarsana-boot-ok.service` runs that check.
- `mode: "0644"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /etc/systemd/system/multi-user.target.d/50-tarsana-boot-ok.conf` makes every boot run it.
- `mode: "0644"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /etc/tarsana/boot-required.services` lists the services that must be running for a boot to count as healthy: Tarsana's update agent.
- `mode: "0644"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /usr/local/sbin/tarsana-boot-watchdog` restarts a server whose boot hangs before that check, so a bad update cannot leave it stuck.
- `mode: "0755"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /etc/systemd/system/tarsana-boot-watchdog.service` starts that timer.
- `mode: "0644"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /etc/systemd/system/sysinit.target.d/50-tarsana-boot-watchdog.conf` makes every boot start it, early.
- `mode: "0644"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /usr/lib/sysctl.d/90-tarsana-panic.conf` restarts the server after a kernel crash instead of waiting.
- `mode: "0644"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /usr/local/sbin/tarsana-node-network` brings up the server's network with the address it had when it was installed, so the update agent can reach Tarsana.
- `mode: "0755"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /etc/systemd/system/tarsana-node-network.service` runs that before the network starts.
- `mode: "0644"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /etc/systemd/system/multi-user.target.d/50-tarsana-node-network.conf` makes every boot run it and start the network.
- `mode: "0644"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `- path: /etc/systemd/system/network-online.target.d/50-tarsana-network-online.conf` makes the update agent wait until the network is up.
- `mode: "0644"` is the file's permissions.
- `content: |` is its content, exactly as written here.
- `placement:` says where servers made from this spec run:
- `provider: hetzner-cloud` in your Hetzner Cloud project,
- `server_type: cpx12` on a `cpx12` server.

## Recipes {#recipes}

Each recipe is a complete spec. Copy it, change the values that are yours, and [check it](#validate).

### Add packages {#recipe-packages}

Install packages by the names your distribution uses, and remove ones you do not want. Leave out a version to get the one in the snapshot.

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
hardening_profile: tarsana-baseline
policy_class: baseline
packages:
  - nginx
  - curl
  - name: telnet
    state: absent
```

See [`packages`](#field-packages).

### Add a file {#recipe-file}

The file's content is in the spec. In YAML, `content: |` keeps the lines below it as they are.

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
hardening_profile: tarsana-baseline
policy_class: baseline
packages:
  - nginx
files:
  - path: /etc/nginx/conf.d/security.conf
    content: |
      server_tokens off;
    mode: "0644"
```

See [`files`](#field-files).

### A user with an SSH key {#recipe-ssh-key}

This spec installs the SSH server, creates the account `deploy` with user ID 2000 and a login shell, and puts your public key in its `authorized_keys` file. Replace the placeholder line with the whole line of your own public key file, for example `~/.ssh/id_ed25519.pub`: as written, the server takes no key at all. With `tarsana-baseline`, the SSH server accepts keys only, never passwords, and `root` cannot sign in.

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
hardening_profile: tarsana-baseline
policy_class: baseline
packages:
  - openssh-server
service_accounts:
  - name: deploy
    uid: 2000
    package: openssh-server
    shell: /bin/bash
    homedir: /home/deploy
files:
  - path: /home/deploy/.ssh/authorized_keys
    content: |
      ssh-ed25519 REPLACE-WITH-YOUR-PUBLIC-KEY you@laptop
    mode: "0600"
    owner: deploy
    group: deploy
```

See [`service_accounts`](#field-service-accounts) and [`files`](#field-files).

### Run a service {#recipe-service}

The server runs your container as a service: it starts at boot and starts again when it stops. Name the container image by its digest, and install a container engine. The registry must be one your tenant may use.

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
hardening_profile: tarsana-baseline
policy_class: baseline
packages:
  - podman
workload:
  containers:
    - name: web
      image: registry.acme.example/acme/web@sha256:9f2c4e1b7a8d3c5f0e6b9a4d2c8f1e7b3a5d9c0e4f8b2a6d1c7e3f9b5a0d4c8e
      env:
        LOG_FORMAT: json
      ports:
        - container: 8080
          host: 80
      restart: always
```

The service is called `tarsana-workload-web`. See [`workload`](#field-workload).

### Keep generated keys {#recipe-keep-keys}

Some packages generate keys while the image is built, such as the SSH server's host keys. Tarsana removes them, so that every server creates its own when it first starts. If your servers must share them, say so, and why. The reason is recorded with the image.

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
hardening_profile: tarsana-baseline
policy_class: baseline
packages:
  - openssh-server
retain_generated_key_material:
  reason: Our load balancer pins one SSH host key for the whole pool
```

See [`retain_generated_key_material`](#field-retain-generated-key-material).

### Run on Hetzner Cloud {#recipe-hetzner}

Add `placement` to create servers from the spec in your own Hetzner Cloud project. It does not change the image. Tarsana keeps the placement of the first submission of a spec, so add it before you submit.

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
hardening_profile: tarsana-baseline
policy_class: baseline
placement:
  provider: hetzner-cloud
  server_type: cpx12
  region: nbg1
  options:
    ipv6: true
    labels:
      team: web
```

See [`placement`](#field-placement), and [Run it on your provider](/quickstarts/run-on-your-provider) for the rest.

## Validate before you submit {#validate}

[`validate`](/api/validate) runs every check that a submission runs, and stores nothing, so you can run it as often as you like.

<!-- tabs -->

#### API {#validate-api}

The API takes the spec as JSON. If you wrote it in YAML, convert it first, for example with Python and PyYAML:

```sh
python3 -c 'import json, sys, yaml; json.dump(yaml.safe_load(sys.stdin), sys.stdout)' < spec.yaml > spec.json
```

```sh
curl -X POST "https://api.tarsana.io/v1/tenants/$TENANT/specs/validate" \
  -H "X-Tarsana-Access-Token: $ACCESS_TOKEN" \
  -H "X-Tarsana-Tenant: $TENANT" \
  -H "Content-Type: application/json" \
  --data @spec.json
```

If the spec is good, `valid` is `true`:

```json
{
  "valid": true,
  "spec_hash": "sha256:cdff062988d4722b2ff052c97ebefb8b571858c493ce47b159df73b1c88809b1",
  "problems": []
}
```

#### Portal {#validate-portal}

Choose **All operations**, then **Check a spec without submitting it**. Fill in **tenant** with your tenant ID, paste the spec into **body** as YAML or JSON, and press **Send**.

#### MCP {#validate-mcp}

Ask your agent:

> Check spec.yaml with Tarsana for tenant acme, without submitting it.

Your agent calls the [`validate`](/api/validate) tool:

```json
{
  "method": "tools/call",
  "params": {
    "name": "validate",
    "arguments": {
      "tenant": "acme",
      "body": {
        "...": "the contents of spec.json"
      }
    }
  }
}
```

<!-- /tabs -->

If `valid` is `false`, `problems` says what to fix, with the path in your spec where it is: `$.packages[1]` is the second entry of `packages`. `problem_details` holds the same problems as data: see [When your spec has a problem](#problems). `submit` refuses the same spec, with the error code shown below.

### Common refusals {#refusals}

#### The version is a number, not text

```yaml
schema_version: 2.0
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
policy_class: baseline
```

`validate` answers with `valid` set to `false`, and `problems` says:

```text
the spec did not validate: $.schema_version: 2.0 is not a MAJOR.MINOR version string (expected e.g. '2.0')
```

`submit` refuses the same spec with [`spec_invalid`](/api/errors#spec_invalid).

**Fix:** Put the version in quotes: `schema_version: "2.0"`.

#### A required field is missing

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
```

`validate` answers with `valid` set to `false`, and `problems` says:

```text
the spec did not validate: $: 'policy_class' is a required property
```

`submit` refuses the same spec with [`spec_invalid`](/api/errors#spec_invalid).

**Fix:** Add the field the answer names. Every spec needs the five fields of [the smallest spec](#minimal).

#### A field name is misspelled

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
policy_class: baseline
package:
  - nginx
```

`validate` answers with `valid` set to `false`, and `problems` says:

```text
the spec did not validate: $: Additional properties are not allowed ('package' was unexpected)
```

`submit` refuses the same spec with [`spec_invalid`](/api/errors#spec_invalid).

**Fix:** Use the name from the [field reference](#fields): here, `packages`.

#### The spec names another tenant

```yaml
schema_version: "2.0"
metadata:
  tenant: tarsana
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
policy_class: baseline
```

`validate` answers with `valid` set to `false`, and `problems` says:

```text
Your spec's metadata.tenant is 'tarsana': change it to 'acme', or delete that line
```

`submit` refuses the same spec with [`tenant_refused`](/api/errors#tenant_refused).

**Fix:** Write your own tenant ID in `metadata.tenant`, or delete the line. Specs copied from Tarsana's examples name `tarsana` there.

#### A container image has a tag instead of a digest

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
policy_class: baseline
packages:
  - podman
workload:
  containers:
    - name: web
      image: registry.example.com/acme/web:latest
```

`validate` answers with `valid` set to `false`, and `problems` says:

```text
the spec did not validate: $.workload.containers[0].image: 'registry.example.com/acme/web:latest' does not match '^[a-z0-9]([a-z0-9.-]*[a-z0-9])?(:[0-9]{1,5})?/[a-z0-9][a-z0-9._/-]*@sha256:[a-f0-9]{64}$'
```

`submit` refuses the same spec with [`spec_invalid`](/api/errors#spec_invalid).

**Fix:** Name the image by its digest: `registry.example.com/acme/web@sha256:` followed by the 64 characters of the digest. `docker buildx imagetools inspect` or `skopeo inspect` shows it.

#### Shorthand fields and layers together

```yaml
schema_version: "2.0"
distro: ubuntu
snapshot_id: "20260715T000000Z"
base_ref: noble
policy_class: baseline
packages:
  - nginx
layers:
  - name: web
    role: node
```

`validate` answers with `valid` set to `false`, and `problems` says:

```text
the spec did not validate: $: 'packages' is the shorthand form and cannot be combined with an explicit 'layers' stack -- move it into the layer it belongs to
```

`submit` refuses the same spec with [`spec_invalid`](/api/errors#spec_invalid).

**Fix:** Move `packages` into the layer, or remove `layers`.

#### A value Tarsana does not offer

A `snapshot_id`, `base_ref` or `policy_class` that is not offered, a repository host that is not allowed, or a container registry your tenant may not use is refused with [`policy_denied`](/api/errors#policy_denied), naming the value. The values on offer are listed with each field below.

## When your spec has a problem {#problems}

`validate` lists each problem twice: in `problems`, as sentences, and in `problem_details`, as data a program or an AI agent can act on. Each entry has the same five keys:

| Key | What it holds |
|---|---|
| `path` | Where the problem is, as a JSON pointer into your spec. `/packages/0` is the first entry of `packages`; an empty `path` means the whole spec. |
| `rule` | Which rule the spec breaks, from the table below. |
| `message` | What is wrong, in a sentence. |
| `fix` | What to change, in a sentence. |
| `expected` | The values the fix refers to: the allowed values, the closest field names, the missing field. Empty when there is nothing to pick. |

For example:

```json
{
  "path": "/files/0/mode",
  "rule": "schema.type",
  "message": "600 is not of type 'string'",
  "fix": "Write it as text.",
  "expected": [
    "string"
  ]
}
```

Fix every problem in the list, then validate again: a spec that passes one check can still fail the next one.

| Rule | What it means and what to do |
|---|---|
| `spec.document` | The spec is not a mapping of fields at all. Write it as YAML or JSON fields. |
| `spec.schema_version` | `schema_version` is missing or is not a version this service reads. Write `schema_version: "2.0"`. |
| `schema.required` | A required field is missing. Add the field named in `expected` at `path`. |
| `schema.additionalProperties` | A field that does not exist here. Rename it to the closest name in `expected`, or delete it. |
| `schema.enum` | A value that is not one of the allowed values. Use one of `expected`. |
| `schema.const` | A value that must be exactly one thing. Use the value in `expected`. |
| `schema.type` | A value of the wrong type. Write it as the type in `expected`. |
| `schema.pattern` | A text value that does not have the required form. Write it so it matches the pattern in `expected`. |
| `schema.minLength` | A text value that is too short. Make it at least `expected` characters long. |
| `schema.maxLength` | A text value that is too long. Make it at most `expected` characters long. |
| `schema.minimum` | A number below the lowest allowed value in `expected`. |
| `schema.maximum` | A number above the highest allowed value in `expected`. |
| `schema.minItems` | A list with too few entries. Give it at least `expected` entries. |
| `schema.maxItems` | A list with too many entries. Give it at most `expected` entries. |
| `schema.uniqueItems` | A list that names the same entry twice. Remove the duplicate. |
| `schema.minProperties` | A mapping with too few fields. Give it at least `expected` fields. |
| `schema.oneOf` | A value that matches none of the forms this field takes. Use one of the forms the reference shows. |
| `schema.anyOf` | A value that matches none of the forms this field takes. Use one of the forms the reference shows. |
| `schema.not` | Two fields that cannot be used together. Keep one of them; the message says which. |
| `schema.dependentRequired` | A field that needs another field beside it. Add the field named in `expected`. |
| `spec.resolved_path` | A path with a `.` or `..` segment. Write the full path without them. |
| `spec.reserved_path_exception` | A reserved-path exception with an unresolved path or an empty reason. Write the exact path and say why. |
| `spec.key_material_opt_out` | Keeping generated keys needs a reason in words. Write one in `reason`. |
| `spec.layer_order` | A `node` layer after a `tenant` layer. Put every `node` layer before the `tenant` layers. |
| `spec.tenant_id` | `metadata.tenant` is not a valid tenant ID. Use your tenant ID, or delete the line. |
| `spec.service_account` | A service account that clashes with another account or with the base system. Pick another name or id. |
| `spec.state` | A `state` declaration that is not an absolute, resolved path, or that names one path twice. |
| `spec.placement` | A `placement` provider or option this service does not offer. Use a provider and options the reference lists. |
| `spec.duplicate` | The same package or file is listed twice with different settings. Keep one entry. |
| `spec.semantic` | A rule of the spec that is not in this table yet. The message says what to change. |
| `tenant.mismatch` | `metadata.tenant` names another tenant. Set it to the value in `expected`, or delete the line. |
| `tenant.refused` | The tenant ID in the request is not one you can use. The spec is not what is wrong. |
| `policy.<control>` | A policy control refuses what the spec asks for. The message names the control and what it refused. |
| any other | A refusal code from [Errors](/api/errors); the fix is what that code means. |


## How your packages are approved {#package-approval}

Every image is checked against a package lock: the list of every package the image is built from, each with its version and the checksum of its file. A build that installs anything that is not on the list is refused.

- If your spec is one of the example specs, such as [`bootable-node`](#minimal-bootable), with only `metadata` and `placement` changed, the lock is the one Tarsana reviewed for that spec.
- Any other spec gets its lock from its own build. Tarsana approves it automatically, with no person in between, when every package comes from your distribution's archive at your `snapshot_id`, from a repository in [`repos`](#field-repos) that Tarsana mirrors and whose signing key it has pinned, or is a container engine package Tarsana provides for your workload. A build with a package from anywhere else is refused at its `scan` stage. You cannot add packages from your own repositories yet.

[`fetch`](/api/fetch) with `artifact` set to `package-lock` gives you the lock your image was checked against, its `digest`, and `approved_by`: `reviewed` when Tarsana reviewed the list, or the name of the policy that approved it automatically.

## Every field {#fields}

Each field below says whether you must write it, what kind of value it takes, what it allows, its default, an example, and what it does in your image. A field inside another one is written with a dot: `placement.provider` is `provider` inside `placement`. `[]` means each entry of a list: `packages[].name` is the `name` of each entry in `packages`.

### Identity and checks {#identity}

Which spec language the spec is written in, what it is called, and which set of rules it is checked against.

[`schema_version`](#field-schema-version) · [`metadata`](#field-metadata) · [`metadata.name`](#field-metadata-name) · [`metadata.tenant`](#field-metadata-tenant) · [`metadata.description`](#field-metadata-description) · [`metadata.annotations`](#field-metadata-annotations) · [`policy_class`](#field-policy-class)

#### `schema_version` {#field-schema-version}

- **Required:** yes
- **Type:** text
- **Allowed:** matches `^2\.(0|[1-9][0-9]*)$`
- **Example:** `schema_version: "2.0"`

The version of the spec language. Write `"2.0"`, in quotes. A version 1 spec is refused: change this one field to `"2.0"` and it is a version 2 spec.

#### `metadata` {#field-metadata}

- **Required:** no
- **Type:** a mapping
- **Example:** `metadata: {"name": "web", "tenant": "acme"}`

Notes about the spec. Metadata never changes the image: two specs that differ only here build the same image and get the same submission ID.

#### `metadata.name` {#field-metadata-name}

- **Required:** no
- **Type:** text
- **Allowed:** not empty
- **Example:** `name: "web"`

A name for the spec, for you to recognise it by.

#### `metadata.tenant` {#field-metadata-tenant}

- **Required:** no
- **Type:** text
- **Allowed:** not empty
- **Example:** `tenant: "acme"`

Your tenant ID. Leave it out and the tenant ID the spec is sent for is used. If you write it, it must be your own tenant ID, or the spec is refused.

> A tenant ID is lowercase letters, digits, `.`, `_` and `-`, starting with a letter or a digit, at most 64 characters.

#### `metadata.description` {#field-metadata-description}

- **Required:** no
- **Type:** text
- **Example:** `description: "The web servers of the shop"`

A sentence or two about what the image is for.

#### `metadata.annotations` {#field-metadata-annotations}

- **Required:** no
- **Type:** a mapping
- **Allowed:** each value is text
- **Example:** `annotations: {"team": "web", "ticket": "OPS-12"}`

Your own key/value notes, such as a team or a ticket number. Nothing reads them.

#### `policy_class` {#field-policy-class}

- **Required:** yes
- **Type:** text
- **Allowed:** matches `^[a-z0-9][a-z0-9-]*$`
- **Example:** `policy_class: "baseline"`

The set of rules the image is checked against before it is signed. A class Tarsana does not offer is refused.

Offered:

- `baseline`: The default, for most images. Files the spec writes may belong to any account. At most 16 ports may be published on the server; below 1024, only `80`, `443`.
- `regulated`: Not available yet: a build that asks for it is refused. The strictest class, for regulated workloads. Files the spec writes may belong to `root` only. No port may be published on the server.
- `restricted`: Stricter than `baseline`, for images that publish few ports. Files the spec writes may belong to `root` only. At most 4 ports may be published on the server; below 1024, only `80`, `443`.

### The operating system {#os}

Every image starts from a distribution, a release and a fixed package snapshot. Together they decide exactly which package versions you get.

[`distro`](#field-distro) · [`snapshot_id`](#field-snapshot-id) · [`base_ref`](#field-base-ref)

#### `distro` {#field-distro}

- **Required:** yes
- **Type:** text
- **Allowed:** one of `ubuntu`, `debian`, `almalinux`
- **Example:** `distro: "ubuntu"`

The Linux distribution the image is built from. Everything else in the spec means the same on each distribution; only package names differ.

#### `snapshot_id` {#field-snapshot-id}

- **Required:** yes
- **Type:** text
- **Allowed:** matches `^[A-Za-z0-9][A-Za-z0-9._:+-]*$`; not empty
- **Example:** `snapshot_id: "20260715T000000Z"`

The package snapshot every package is taken from. A snapshot never changes, so the same spec always gets the same package versions. To pick up security updates, move to a newer snapshot. A snapshot that is not offered for your `distro` is refused. In YAML, keep the quotes.

Offered:

- For `almalinux`: `almalinux-9.5-20260807T164433Z.sha256:1f6c9c66e6fd0ea5422c7b55f83c24add67173c0f2788c8fa0a7790641d72438`.
- For `debian`: `20260601T000000Z`, `20260715T000000Z`, `20260730T000000Z`.
- For `ubuntu`: `20260601T000000Z`, `20260715T000000Z`, `20260730T000000Z`.

#### `base_ref` {#field-base-ref}

- **Required:** yes
- **Type:** text
- **Allowed:** not empty
- **Example:** `base_ref: "noble"`

The release of the distribution: `noble` is Ubuntu 24.04, `trixie` is Debian 13 and `9` is AlmaLinux 9. In YAML, write `"9"` in quotes. A release that is not offered for your `distro` is refused.

Offered:

- For `almalinux`: `9`.
- For `debian`: `trixie`.
- For `ubuntu`: `noble`.

### Packages {#packages}

What to install on top of the operating system, and from which extra repositories.

[`repos`](#field-repos) · [`repos[].id`](#field-repos-id) · [`repos[].url`](#field-repos-url) · [`repos[].signing_key`](#field-repos-signing-key) · [`repos[].signing_key.fingerprint`](#field-repos-signing-key-fingerprint) · [`repos[].signing_key.url`](#field-repos-signing-key-url) · [`repos[].selectors`](#field-repos-selectors) · [`packages`](#field-packages) · [`packages[].name`](#field-packages-name) · [`packages[].version`](#field-packages-version) · [`packages[].kind`](#field-packages-kind) · [`packages[].state`](#field-packages-state)

#### `repos` {#field-repos}

- **Required:** no
- **Type:** a list of mappings
- **Example:** `repos: [{"id": "ubuntu-main", "url": "https://snapshot.ubuntu.com/ubuntu", "selectors": ["noble", "main", "universe"], "signing_key": {"fingerprint": "F6ECB3762474EDA9D21B7022871920D1991BC93C"}}]`

Extra package repositories, each pinned to its signing key. Use them for software the distribution does not carry. Only some hosts are allowed: see `repos[].url`.

#### `repos[].id` {#field-repos-id}

- **Required:** yes, in each entry of [`repos`](#field-repos)
- **Type:** text
- **Allowed:** matches `^[a-z0-9][a-z0-9-]*$`
- **Example:** `id: "ubuntu-main"`

A short name for the repository, used only inside the spec.

#### `repos[].url` {#field-repos-url}

- **Required:** yes, in each entry of [`repos`](#field-repos)
- **Type:** text
- **Allowed:** matches `^https?://[^\s]+$`
- **Example:** `url: "https://snapshot.ubuntu.com/ubuntu"`

Where the repository is. Only the hosts and the address schemes below are allowed; any other is refused.

Allowed hosts:

- `download.docker.com`, for `ubuntu`, `debian`.
- `pkgs.k8s.io`, for `ubuntu`, `debian`.
- `ppa.launchpadcontent.net`, for `ubuntu`.
- `repo.almalinux.org`, for `almalinux`.
- `snapshot.debian.org`, for `debian`.
- `snapshot.ubuntu.com`, for `ubuntu`.
- `vault.almalinux.org`, for `almalinux`.
- Address schemes: `https`.

#### `repos[].signing_key` {#field-repos-signing-key}

- **Required:** yes, in each entry of [`repos`](#field-repos)
- **Type:** a mapping
- **Example:** `signing_key: {"fingerprint": "F6ECB3762474EDA9D21B7022871920D1991BC93C"}`

The key the repository is signed with. Packages that are not signed with it are not installed.

#### `repos[].signing_key.fingerprint` {#field-repos-signing-key-fingerprint}

- **Required:** yes, when you use [`repos[].signing_key`](#field-repos-signing-key)
- **Type:** text
- **Allowed:** matches `^[A-F0-9]{40}$`
- **Example:** `fingerprint: "F6ECB3762474EDA9D21B7022871920D1991BC93C"`

The key's fingerprint: 40 characters, digits and the capital letters A to F, without spaces.

#### `repos[].signing_key.url` {#field-repos-signing-key-url}

- **Required:** no
- **Type:** text
- **Allowed:** matches `^https?://[^\s]+$`
- **Example:** `url: "https://example.com/apt/key.asc"`

Where the key itself can be downloaded.

#### `repos[].selectors` {#field-repos-selectors}

- **Required:** no
- **Type:** a list of text values
- **Allowed:** each entry at least 1 character
- **Example:** `selectors: ["noble", "main", "universe"]`

Which part of the repository to use, in order. For Ubuntu and Debian: the release, then the components. For AlmaLinux, usually empty.

#### `packages` {#field-packages}

- **Required:** no
- **Type:** a list of names or mappings
- **Example:** `packages: ["nginx", {"name": "telnet", "state": "absent"}]`

The packages to install, by the name your distribution uses. Write a package as just its name, or as a mapping when you need a version or want to remove a package. Whether each package exists in the snapshot is checked when the image is built.

> A package may appear only once, unless both entries say the same thing.

#### `packages[].name` {#field-packages-name}

- **Required:** yes, in each entry of [`packages`](#field-packages)
- **Type:** text
- **Allowed:** matches `^[A-Za-z0-9][A-Za-z0-9._+-]*$`
- **Example:** `name: "nginx"`

The package name, as your distribution knows it.

#### `packages[].version` {#field-packages-version}

- **Required:** no
- **Type:** text
- **Allowed:** not empty
- **Example:** `version: "8.0.46-0ubuntu0.24.04.3"`

An exact version. Leave it out to take the version the snapshot has, which is just as fixed: the snapshot never changes.

#### `packages[].kind` {#field-packages-kind}

- **Required:** no
- **Type:** text
- **Allowed:** one of `package`, `group`
- **Default:** `package`
- **Example:** `kind: "package"`

`group` installs a group of packages (an Ubuntu or Debian task or metapackage, an AlmaLinux group) instead of one package.

#### `packages[].state` {#field-packages-state}

- **Required:** no
- **Type:** text
- **Allowed:** one of `present`, `absent`
- **Default:** `present`
- **Example:** `state: "absent"`

`absent` removes a package the operating system would otherwise have.

### Files {#files}

Files written into the image, with their content in the spec itself.

[`files`](#field-files) · [`files[].path`](#field-files-path) · [`files[].content`](#field-files-content) · [`files[].mode`](#field-files-mode) · [`files[].owner`](#field-files-owner) · [`files[].group`](#field-files-group)

#### `files` {#field-files}

- **Required:** no
- **Type:** a list of mappings
- **Example:** `files: [{"path": "/etc/motd", "content": "Managed by Tarsana.\n"}]`

Files to write into the image. Each file's content is in the spec, so the spec alone says what the image holds.

#### `files[].path` {#field-files-path}

- **Required:** yes, in each entry of [`files`](#field-files)
- **Type:** text
- **Allowed:** matches `^/(?:[^/\u0000]+/)*[^/\u0000]+$`
- **Example:** `path: "/etc/nginx/conf.d/site.conf"`

Where the file goes: a full path, starting with `/`. Each path may appear only once.

> A path may not contain `.` or `..` as a part: write the path it resolves to.

#### `files[].content` {#field-files-content}

- **Required:** yes, in each entry of [`files`](#field-files)
- **Type:** text
- **Example:** `content: "server_tokens off;\n"`

The whole content of the file, as text. In YAML, write `content: |` and the text indented below it.

#### `files[].mode` {#field-files-mode}

- **Required:** no
- **Type:** text
- **Allowed:** matches `^0[0-7]{3}$`
- **Default:** `0644`
- **Example:** `mode: "0600"`

Who may read, write and run the file, as four octal digits. In YAML, keep the quotes.

#### `files[].owner` {#field-files-owner}

- **Required:** no
- **Type:** text
- **Allowed:** not empty
- **Default:** `root`
- **Example:** `owner: "root"`

The account that owns the file. Some `policy_class` values allow only `root`.

#### `files[].group` {#field-files-group}

- **Required:** no
- **Type:** text
- **Allowed:** not empty
- **Default:** `root`
- **Example:** `group: "root"`

The group that owns the file.

### Users and keys {#users}

Accounts with a fixed user ID. An account belongs to a package in the same spec and is created just before that package is installed. To let an account sign in over SSH, also install `openssh-server` and write its `authorized_keys` file with `files`: see the recipe [A user with an SSH key](#recipe-ssh-key).

[`service_accounts`](#field-service-accounts) · [`service_accounts[].name`](#field-service-accounts-name) · [`service_accounts[].uid`](#field-service-accounts-uid) · [`service_accounts[].gid`](#field-service-accounts-gid) · [`service_accounts[].description`](#field-service-accounts-description) · [`service_accounts[].shell`](#field-service-accounts-shell) · [`service_accounts[].homedir`](#field-service-accounts-homedir) · [`service_accounts[].package`](#field-service-accounts-package)

#### `service_accounts` {#field-service-accounts}

- **Required:** no
- **Type:** a list of mappings
- **Example:** `service_accounts: [{"name": "mysql", "uid": 27000, "package": "mysql-server"}]`

Accounts to create, each with the user ID you choose. Without this, a package that creates its own account picks a number itself; declaring it keeps the number the same in every build, so files on your data disks keep their owner.

#### `service_accounts[].name` {#field-service-accounts-name}

- **Required:** yes, in each entry of [`service_accounts`](#field-service-accounts)
- **Type:** text
- **Allowed:** matches `^[a-z_][a-z0-9_-]*[$]?$`; at most 32 characters
- **Example:** `name: "deploy"`

The account name. A group of the same name is created with it.

#### `service_accounts[].uid` {#field-service-accounts-uid}

- **Required:** yes, in each entry of [`service_accounts`](#field-service-accounts)
- **Type:** a whole number
- **Allowed:** 0 to 4294967293
- **Example:** `uid: 2000`

The user ID, used exactly as written. Pick a number nothing in the base system uses, such as one above 2000.

> A user ID the base system already gives another account, such as 0 for `root`, is refused, and the answer names that account.

#### `service_accounts[].gid` {#field-service-accounts-gid}

- **Required:** no
- **Type:** a whole number
- **Allowed:** 0 to 4294967293
- **Example:** `gid: 2000`

The group ID of the account's group. Leave it out to use the same number as `uid`.

#### `service_accounts[].description` {#field-service-accounts-description}

- **Required:** no
- **Type:** text
- **Allowed:** matches `^[^:\t\n\r]*$`; at most 255 characters
- **Example:** `description: "Deploys the web site"`

A description of the account, shown by tools that list accounts. It may not contain `:`.

#### `service_accounts[].shell` {#field-service-accounts-shell}

- **Required:** no
- **Type:** text
- **Allowed:** matches `^/(?:[^/\u0000:]+/)*[^/\u0000:]+$`
- **Example:** `shell: "/bin/bash"`

The program the account gets when it signs in. Leave it out for an account nobody signs in to; set `/bin/bash` for one you sign in to over SSH.

#### `service_accounts[].homedir` {#field-service-accounts-homedir}

- **Required:** no
- **Type:** text
- **Allowed:** matches `^/$|^/(?:[^/\u0000:]+/)*[^/\u0000:]+$`
- **Example:** `homedir: "/home/deploy"`

The account's home directory. Leave it out for the distribution's default.

#### `service_accounts[].package` {#field-service-accounts-package}

- **Required:** yes, in each entry of [`service_accounts`](#field-service-accounts)
- **Type:** text
- **Allowed:** matches `^[A-Za-z0-9][A-Za-z0-9._+-]*$`
- **Example:** `package: "openssh-server"`

The package the account belongs to. The account is created just before that package is installed, so the package uses the number you chose.

> The package must be installed by the same spec, in the same layer as the account.

### Services {#services}

Containers the server runs as services. The image starts each one at boot, from the exact container image you name by digest. The container itself is never copied into the image.

[`workload`](#field-workload) · [`workload.runtime`](#field-workload-runtime) · [`workload.containers`](#field-workload-containers) · [`workload.containers[].name`](#field-workload-containers-name) · [`workload.containers[].image`](#field-workload-containers-image) · [`workload.containers[].env`](#field-workload-containers-env) · [`workload.containers[].args`](#field-workload-containers-args) · [`workload.containers[].ports`](#field-workload-containers-ports) · [`workload.containers[].ports[].container`](#field-workload-containers-ports-container) · [`workload.containers[].ports[].host`](#field-workload-containers-ports-host) · [`workload.containers[].ports[].protocol`](#field-workload-containers-ports-protocol) · [`workload.containers[].restart`](#field-workload-containers-restart)

#### `workload` {#field-workload}

- **Required:** no
- **Type:** a mapping
- **Example:** `workload: {"containers": [{"name": "web", "image": "registry.example.com/acme/web@sha256:9f2c4e1b7a8d3c5f0e6b9a4d2c8f1e7b3a5d9c0e4f8b2a6d1c7e3f9b5a0d4c8e"}]}`

The containers the server runs. Each container becomes a service that starts at boot and is restarted as `restart` says. Install a container engine in `packages` too.

Needs:

- Install one container engine in `packages`: `podman` or `containerd` and `nerdctl`. A workload without one is refused when the image is built.

> Without a container engine in `packages`, the build stops.

#### `workload.runtime` {#field-workload-runtime}

- **Required:** no
- **Type:** text
- **Allowed:** one of `systemd-unit`, `kubernetes`
- **Default:** `systemd-unit`
- **Example:** `runtime: "systemd-unit"`

How the server runs the containers. `systemd-unit` runs each one as a service.

> `kubernetes` is not available yet: the build stops at it.

#### `workload.containers` {#field-workload-containers}

- **Required:** yes, when you use [`workload`](#field-workload)
- **Type:** a list of mappings
- **Allowed:** at least one entry
- **Example:** `containers: [{"name": "web", "image": "registry.example.com/acme/web@sha256:9f2c4e1b7a8d3c5f0e6b9a4d2c8f1e7b3a5d9c0e4f8b2a6d1c7e3f9b5a0d4c8e"}]`

The containers, at least one. Each name may appear only once.

#### `workload.containers[].name` {#field-workload-containers-name}

- **Required:** yes, in each entry of [`workload.containers`](#field-workload-containers)
- **Type:** text
- **Allowed:** matches `^[a-z0-9][a-z0-9-]*$`
- **Example:** `name: "web"`

The container's name. The service on the server is called `tarsana-workload-` followed by this name.

#### `workload.containers[].image` {#field-workload-containers-image}

- **Required:** yes, in each entry of [`workload.containers`](#field-workload-containers)
- **Type:** text
- **Allowed:** matches `^[a-z0-9]([a-z0-9.-]*[a-z0-9])?(:[0-9]{1,5})?/[a-z0-9][a-z0-9._/-]*@sha256:[a-f0-9]{64}$`
- **Example:** `image: "registry.example.com/acme/web@sha256:9f2c4e1b7a8d3c5f0e6b9a4d2c8f1e7b3a5d9c0e4f8b2a6d1c7e3f9b5a0d4c8e"`

The container image, with its registry and its `sha256` digest. A tag such as `:latest` is refused: with a digest, every server runs exactly the same container. The server downloads the container when it starts it. The registry must be one your tenant may use; any other is refused.

#### `workload.containers[].env` {#field-workload-containers-env}

- **Required:** no
- **Type:** a mapping
- **Allowed:** each key matches `^[A-Za-z_][A-Za-z0-9_]*$`; each value is text
- **Example:** `env: {"LOG_FORMAT": "json"}`

Environment variables for the container. Never put a password or a key here: the spec is stored and shown as it is.

#### `workload.containers[].args` {#field-workload-containers-args}

- **Required:** no
- **Type:** a list of text values
- **Example:** `args: ["--listen", "0.0.0.0:8080"]`

Arguments passed to the container, in this order.

#### `workload.containers[].ports` {#field-workload-containers-ports}

- **Required:** no
- **Type:** a list of mappings
- **Example:** `ports: [{"container": 8080, "host": 80}]`

The ports the container listens on, and which of them the server publishes.

#### `workload.containers[].ports[].container` {#field-workload-containers-ports-container}

- **Required:** yes, in each entry of [`workload.containers[].ports`](#field-workload-containers-ports)
- **Type:** a whole number
- **Allowed:** 1 to 65535
- **Example:** `container: 8080`

The port inside the container.

#### `workload.containers[].ports[].host` {#field-workload-containers-ports-host}

- **Required:** no
- **Type:** a whole number
- **Allowed:** 1 to 65535
- **Example:** `host: 80`

The port on the server that leads to it. Leave it out and the port is not reachable from outside the server.

#### `workload.containers[].ports[].protocol` {#field-workload-containers-ports-protocol}

- **Required:** no
- **Type:** text
- **Allowed:** one of `tcp`, `udp`
- **Default:** `tcp`
- **Example:** `protocol: "tcp"`

`tcp` or `udp`.

#### `workload.containers[].restart` {#field-workload-containers-restart}

- **Required:** no
- **Type:** text
- **Allowed:** one of `always`, `on-failure`, `never`
- **Default:** `always`
- **Example:** `restart: "on-failure"`

Whether the service starts the container again when it stops: `always`, only `on-failure`, or `never`.

### Hardening and opt-outs {#hardening}

How the image is hardened, and the one thing you can ask Tarsana to keep that it removes by default.

[`hardening_profile`](#field-hardening-profile) · [`hardening_packages`](#field-hardening-packages) · [`retain_generated_key_material`](#field-retain-generated-key-material) · [`retain_generated_key_material.reason`](#field-retain-generated-key-material-reason)

#### `hardening_profile` {#field-hardening-profile}

- **Required:** no
- **Type:** text
- **Allowed:** one of `none`, `tarsana-baseline`, `cis-level1`, `cis-level2`, `stig`, `pci-dss`
- **Default:** `none`
- **Example:** `hardening_profile: "tarsana-baseline"`

How the image is hardened. `tarsana-baseline` is Tarsana's own baseline; the CIS and PCI DSS profiles apply the published benchmark's settings. `none`, the default, hardens nothing. A profile that is not available for your `distro` and `base_ref` is refused when the image is built.

Available for:

- `none`: almalinux 9, debian trixie, ubuntu noble.
- `tarsana-baseline`: almalinux 9, debian trixie, ubuntu noble.
- `cis-level1`: almalinux 9, ubuntu noble.
- `cis-level2`: almalinux 9, ubuntu noble.
- `stig`: not available yet; a build that asks for it is refused.
- `pci-dss`: almalinux 9.

#### `hardening_packages` {#field-hardening-packages}

- **Required:** no
- **Type:** a list of text values
- **Allowed:** each entry matches `^[A-Za-z0-9][A-Za-z0-9._+-]*$`
- **Example:** `hardening_packages: ["aide", "auditd", "chrony"]`

Only for the CIS and PCI DSS profiles: the packages the profile may install while it hardens the image. The list must be exactly the one Tarsana works out for your profile, `distro` and `base_ref`; if yours differs, the build stops and names the packages to add or remove. Leave it out for `none` and `tarsana-baseline`.

#### `retain_generated_key_material` {#field-retain-generated-key-material}

- **Required:** no
- **Type:** a mapping
- **Example:** `retain_generated_key_material: {"reason": "Our load balancer pins one SSH host key for the whole pool"}`

Keeps the keys that packages generate while the image is built, such as SSH host keys. By default Tarsana removes them, so every server creates its own when it first starts and no two servers share a key. Add this only if your servers must share those keys, and say why: the reason is recorded with the image.

#### `retain_generated_key_material.reason` {#field-retain-generated-key-material-reason}

- **Required:** yes, when you use [`retain_generated_key_material`](#field-retain-generated-key-material)
- **Type:** text
- **Allowed:** not empty
- **Example:** `reason: "Our load balancer pins one SSH host key for the whole pool"`

Why the image must keep the generated keys, in your own words.

> A reason of only spaces is refused.

### Data that survives a restart {#data}

Tarsana works out by itself which directories hold data that must survive a restart. Use these fields only for what it cannot see, such as a directory a program creates the first time it runs. You never need them for a spec to be accepted.

[`state`](#field-state) · [`state.persist`](#field-state-persist) · [`state.volatile`](#field-state-volatile) · [`state.exec`](#field-state-exec)

#### `state` {#field-state}

- **Required:** no
- **Type:** a mapping
- **Example:** `state: {"persist": ["/var/lib/myapp"]}`

Directories to treat differently from what Tarsana works out by itself.

#### `state.persist` {#field-state-persist}

- **Required:** no
- **Type:** a list of text values
- **Allowed:** each entry matches `^/(?:[^/\u0000]+/)*[^/\u0000]+$`
- **Example:** `persist: ["/var/lib/myapp"]`

Directories whose content must survive a restart, such as a directory your program creates the first time it runs. Use a directory under `/var/lib`, `/srv`, `/var/www`, `/var/spool`, `/var/opt` or `/home`.

#### `state.volatile` {#field-state-volatile}

- **Required:** no
- **Type:** a list of text values
- **Allowed:** each entry matches `^/(?:[^/\u0000]+/)*[^/\u0000]+$`
- **Example:** `volatile: ["/var/cache/myapp"]`

Directories Tarsana would keep across a restart that only hold scratch data. They are not kept.

#### `state.exec` {#field-state-exec}

- **Required:** no
- **Type:** a list of text values
- **Allowed:** each entry matches `^/(?:[^/\u0000]+/)*[^/\u0000]+$`
- **Example:** `exec: ["/var/lib/myapp/plugins"]`

Directories that hold programs which arrive after the server starts. By default, a directory that held no program when the image was built may not run one.

### Layers {#layers}

Instead of `packages`, `files`, `service_accounts`, `state` and `workload` at the top of the spec, you can split the image into named layers. Two specs that share a layer share its build. Use one form or the other, not both.

[`layers`](#field-layers) · [`layers[].name`](#field-layers-name) · [`layers[].role`](#field-layers-role) · [`layers[].packages`](#field-layers-packages) · [`layers[].files`](#field-layers-files) · [`layers[].repos`](#field-layers-repos) · [`layers[].service_accounts`](#field-layers-service-accounts) · [`layers[].state`](#field-layers-state) · [`layers[].reserved_path_exceptions`](#field-layers-reserved-path-exceptions) · [`layers[].reserved_path_exceptions[].path`](#field-layers-reserved-path-exceptions-path) · [`layers[].reserved_path_exceptions[].reason`](#field-layers-reserved-path-exceptions-reason) · [`layers[].workload`](#field-layers-workload)

#### `layers` {#field-layers}

- **Required:** no
- **Type:** a list of mappings
- **Allowed:** at least one entry
- **Example:** `layers: [{"name": "web", "role": "node", "packages": ["nginx"]}]`

The image as a list of named layers, in order: every `node` layer first, then the `tenant` layers. Only one layer may carry a workload.

> `packages`, `files`, `service_accounts`, `state` and `workload` at the top of the spec cannot be combined with `layers`: move them into a layer.

#### `layers[].name` {#field-layers-name}

- **Required:** yes, in each entry of [`layers`](#field-layers)
- **Type:** text
- **Allowed:** matches `^[a-z0-9][a-z0-9-]*$`
- **Example:** `name: "web"`

The layer's name, unique within the spec.

#### `layers[].role` {#field-layers-role}

- **Required:** yes, in each entry of [`layers`](#field-layers)
- **Type:** text
- **Allowed:** one of `node`, `tenant`
- **Example:** `role: "node"`

`node` for the operating system's packages, files and accounts; `tenant` for the workload.

> Every `node` layer comes before every `tenant` layer.

> Only a `tenant` layer may have a `workload`, and an image has one workload.

#### `layers[].packages` {#field-layers-packages}

- **Required:** no
- **Type:** a list of names or mappings
- **Example:** `packages: ["nginx"]`

This layer's packages, written as in [`packages`](#field-packages).

#### `layers[].files` {#field-layers-files}

- **Required:** no
- **Type:** a list of mappings
- **Example:** `files: [{"path": "/etc/motd", "content": "Managed by Tarsana.\n"}]`

This layer's files, written as in [`files`](#field-files).

#### `layers[].repos` {#field-layers-repos}

- **Required:** no
- **Type:** a list of mappings
- **Example:** `repos: [{"id": "ubuntu-main", "url": "https://snapshot.ubuntu.com/ubuntu", "selectors": ["noble", "main"], "signing_key": {"fingerprint": "F6ECB3762474EDA9D21B7022871920D1991BC93C"}}]`

Extra repositories for this layer only, written as in [`repos`](#field-repos).

#### `layers[].service_accounts` {#field-layers-service-accounts}

- **Required:** no
- **Type:** a list of mappings
- **Example:** `service_accounts: [{"name": "mysql", "uid": 27000, "package": "mysql-server"}]`

This layer's accounts, written as in [`service_accounts`](#field-service-accounts). Each account's package must be installed by this layer.

#### `layers[].state` {#field-layers-state}

- **Required:** no
- **Type:** a mapping
- **Example:** `state: {"persist": ["/var/lib/myapp"]}`

This layer's directories, written as in [`state`](#field-state).

#### `layers[].reserved_path_exceptions` {#field-layers-reserved-path-exceptions}

- **Required:** no
- **Type:** a list of mappings
- **Example:** `reserved_path_exceptions: [{"path": "/etc/pam.d/sshd", "reason": "openssh-server installs its own PAM file here"}]`

Files this layer must write although the hardening profile owns them, such as a package's own configuration file. Each needs the exact path and a reason; a path the layer does not write, or one the hardening profile does not own, is refused when the image is built.

#### `layers[].reserved_path_exceptions[].path` {#field-layers-reserved-path-exceptions-path}

- **Required:** yes, in each entry of [`layers[].reserved_path_exceptions`](#field-layers-reserved-path-exceptions)
- **Type:** text
- **Allowed:** matches `^/(?:[^/\u0000]+/)*[^/\u0000]+$`
- **Example:** `path: "/etc/pam.d/sshd"`

The exact path of the file.

#### `layers[].reserved_path_exceptions[].reason` {#field-layers-reserved-path-exceptions-reason}

- **Required:** yes, in each entry of [`layers[].reserved_path_exceptions`](#field-layers-reserved-path-exceptions)
- **Type:** text
- **Allowed:** not empty
- **Example:** `reason: "openssh-server installs its own PAM file here"`

Why this layer must write the file, in your own words.

#### `layers[].workload` {#field-layers-workload}

- **Required:** no
- **Type:** a mapping
- **Example:** `workload: {"containers": [{"name": "web", "image": "registry.example.com/acme/web@sha256:9f2c4e1b7a8d3c5f0e6b9a4d2c8f1e7b3a5d9c0e4f8b2a6d1c7e3f9b5a0d4c8e"}]}`

The workload of a `tenant` layer, written as in [`workload`](#field-workload).

### Where servers run {#placement}

Where Tarsana creates servers from this spec. Placement does not change the image or the spec's hash. You need it only to create servers; a spec without it is still built.

[`placement`](#field-placement) · [`placement.provider`](#field-placement-provider) · [`placement.server_type`](#field-placement-server-type) · [`placement.region`](#field-placement-region) · [`placement.options`](#field-placement-options) · [`placement.options.ipv6`](#field-placement-options-ipv6) · [`placement.options.labels`](#field-placement-options-labels)

#### `placement` {#field-placement}

- **Required:** no
- **Type:** a mapping
- **Example:** `placement: {"provider": "hetzner-cloud", "server_type": "cpx12", "region": "nbg1"}`

Where servers made from this spec are created: the provider and the server type. Tarsana keeps the placement of the first submission of a spec, so add it before you submit.

#### `placement.provider` {#field-placement-provider}

- **Required:** yes, when you use [`placement`](#field-placement)
- **Type:** text
- **Allowed:** matches `^[a-z0-9]([a-z0-9-]*[a-z0-9])?$`; at most 63 characters
- **Example:** `provider: "hetzner-cloud"`

The provider your servers run at.

Offered:

- `aws-ec2`, with `labels`.
- `equinix-metal`, with `ipv6`, `labels`.
- `hetzner-cloud`, with `ipv6`, `labels`.
- `scaleway-instances`, with `labels`.
- `vultr-bare-metal`, with `ipv6`.

> A provider Tarsana does not know, or cannot create servers at yet, is refused, and the answer lists the ones it can.

#### `placement.server_type` {#field-placement-server-type}

- **Required:** yes, when you use [`placement`](#field-placement)
- **Type:** text
- **Allowed:** matches `^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$`; 1 to 64 characters
- **Example:** `server_type: "cpx12"`

The provider's own name for the server type, written exactly as the provider writes it. Whether the provider has it is checked when the server is created.

#### `placement.region` {#field-placement-region}

- **Required:** no
- **Type:** text
- **Allowed:** matches `^[a-z0-9]([a-z0-9-]*[a-z0-9])?$`; at most 63 characters
- **Example:** `region: "nbg1"`

The provider's own name for the location. Leave it out to let the provider choose.

#### `placement.options` {#field-placement-options}

- **Required:** no
- **Type:** a mapping
- **Example:** `options: {"ipv6": true, "labels": {"team": "web"}}`

Settings for the new server. Each provider supports some of them; see `provider` above.

> An option your provider does not support is refused.

#### `placement.options.ipv6` {#field-placement-options-ipv6}

- **Required:** no
- **Type:** `true` or `false`
- **Example:** `ipv6: true`

Whether the server gets a public IPv6 address.

#### `placement.options.labels` {#field-placement-options-labels}

- **Required:** no
- **Type:** a mapping
- **Allowed:** each key matches `^(?!tarsana)[a-z0-9]([a-z0-9._-]*[a-z0-9])?$`; each key at most 63 characters; each value matches `^([A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?)?$`
- **Example:** `labels: {"team": "web", "env": "production"}`

Labels put on the server at the provider, for your own sorting and billing.

> Label names starting with `tarsana` are reserved for Tarsana's own labels.
