Files
Kamino/roles/openbao/templates/openbao.hcl.j2
T
Defame1297 eda69bcbf5 feat(openbao): add the role's main entry point
A consumer gets a running single-node OpenBao server on integrated raft
storage, listening on TLS they supply, left uninitialised and sealed.

The role installs the pinned 2.7.3 release tarball, checked by get_url
against the sha256 of each architecture from the release's checksums.txt
(its GPG signature checks out against OpenBao's release key). It creates
its own system user, data directory, configuration and sandboxed unit:
Type=notify, SIGINT stop, MemorySwapMax=0 instead of mlock, an empty
capability set, ProtectSystem=strict with the data directory writable,
and ExecReload sending SIGHUP. The directive set was tried against the
real binary under systemd before it was kept.

TLS certificate, key and CA paths are required unless openbao_tls_disable
is true, which warns; validation fails before any change when a file is
missing, and the role checks the service user can read the key and
certificate before writing the config. It reads its seal status over
https://127.0.0.1 validated against the CA file, so an address other
than a wildcard or loopback gets a second loopback listener.

The tasks are split by job (validate, prereqs, install, configure,
seal_status) so the init, unseal, audit and update work can reuse them.

Refs: #536
Assisted-by: Claude Code
2026-12-06 21:19:15 +00:00

35 lines
1.1 KiB
Django/Jinja

{{ ansible_managed | comment }}
{% macro hostport(address, port) %}{{ ('[' ~ address ~ ']') if ':' in address else address }}:{{ port }}{% endmacro %}
{% macro tls() %}
{% if openbao_tls_disable | bool %}
tls_disable = true
{% else %}
tls_cert_file = {{ openbao_tls_cert_file | to_json }}
tls_key_file = {{ openbao_tls_key_file | to_json }}
tls_min_version = {{ openbao_tls_min_version | to_json }}
{% endif %}
{% endmacro %}
ui = {{ openbao_ui | bool | lower }}
api_addr = {{ openbao_api_addr | to_json }}
cluster_addr = {{ openbao_cluster_addr | to_json }}
storage "raft" {
path = {{ openbao_data_dir | to_json }}
node_id = {{ openbao_node_id | to_json }}
}
listener "tcp" {
address = {{ hostport(openbao_listen_address, openbao_port) | to_json }}
cluster_address = {{ hostport(openbao_listen_address, openbao_cluster_port) | to_json }}
{{ tls() -}}
}
{% if openbao_listen_address not in ['0.0.0.0', '::', '127.0.0.1'] %}
# The role reads its own API on loopback.
listener "tcp" {
address = {{ hostport('127.0.0.1', openbao_port) | to_json }}
{{ tls() -}}
}
{% endif %}