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
40 lines
1.5 KiB
YAML
40 lines
1.5 KiB
YAML
---
|
|
# get_url checks the pinned sha256 before it keeps the archive, so a tampered or replaced asset
|
|
# never reaches the extraction. Only bao is extracted: the archive also holds the licence,
|
|
# README and changelog, which do not belong in a bin directory.
|
|
# Skipped under --check: tempfile and the extraction of a gzipped tarball cannot run in check
|
|
# mode, and nothing is downloaded.
|
|
- name: Download, verify and extract OpenBao
|
|
become: true
|
|
when: not ansible_check_mode
|
|
tags: [openbao, install]
|
|
block:
|
|
- name: Create a download directory
|
|
ansible.builtin.tempfile:
|
|
state: directory
|
|
suffix: .openbao
|
|
register: __openbao_download_dir
|
|
|
|
- name: Download and verify the OpenBao archive
|
|
ansible.builtin.get_url:
|
|
url: "{{ openbao_release_url }}/openbao_{{ openbao_version }}_linux_{{ __openbao_arch }}.tar.gz"
|
|
dest: "{{ __openbao_download_dir.path }}/openbao.tar.gz"
|
|
checksum: "sha256:{{ openbao_sha256[__openbao_arch] }}"
|
|
mode: "0600"
|
|
|
|
- name: Extract the bao binary
|
|
ansible.builtin.unarchive:
|
|
src: "{{ __openbao_download_dir.path }}/openbao.tar.gz"
|
|
dest: "{{ openbao_bin_path | dirname }}"
|
|
remote_src: true
|
|
include: [bao]
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
always:
|
|
- name: Remove the download directory
|
|
ansible.builtin.file:
|
|
path: "{{ __openbao_download_dir.path }}"
|
|
state: absent
|
|
when: __openbao_download_dir.path is defined
|