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
52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
---
|
|
- name: Create the OpenBao group
|
|
become: true
|
|
ansible.builtin.group:
|
|
name: "{{ openbao_group }}"
|
|
system: true
|
|
register: __openbao_group_account
|
|
tags: [openbao, prereqs, always]
|
|
|
|
- name: Create the OpenBao user
|
|
become: true
|
|
ansible.builtin.user:
|
|
name: "{{ openbao_user }}"
|
|
group: "{{ openbao_group }}"
|
|
shell: /usr/sbin/nologin
|
|
home: "{{ openbao_data_dir }}"
|
|
comment: "OpenBao secret store"
|
|
system: true
|
|
create_home: false
|
|
register: __openbao_user_account
|
|
tags: [openbao, prereqs, always]
|
|
|
|
# The config holds no secret, but the service user reads it and no one else needs to.
|
|
- name: Create the OpenBao directories
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ __openbao_dir.path }}"
|
|
state: directory
|
|
owner: "{{ __openbao_dir.owner }}"
|
|
group: "{{ openbao_group }}"
|
|
mode: "{{ __openbao_dir.mode }}"
|
|
loop:
|
|
- {path: "{{ openbao_config_dir }}", owner: root, mode: "0750"}
|
|
- {path: "{{ openbao_data_dir }}", owner: "{{ openbao_user }}", mode: "0700"}
|
|
loop_control:
|
|
loop_var: __openbao_dir
|
|
label: "{{ __openbao_dir.path }}"
|
|
# Under --check a new account is only simulated, so a directory cannot be chowned to it.
|
|
when: not ansible_check_mode or (__openbao_group_account is not changed and __openbao_user_account is not changed)
|
|
tags: [openbao, prereqs, always]
|
|
|
|
- name: Check if the OpenBao binary exists
|
|
ansible.builtin.stat:
|
|
path: "{{ openbao_bin_path }}"
|
|
register: __openbao_binary
|
|
tags: [openbao, prereqs, always]
|
|
|
|
- name: Set the OpenBao install fact
|
|
ansible.builtin.set_fact:
|
|
__openbao_installed: "{{ __openbao_binary.stat.exists }}"
|
|
tags: [openbao, prereqs, always]
|