The readability check of the TLS certificate and key ran after the role had created the user and directories and installed the binary, so a fresh host with a key the service user cannot read was changed and then failed. It now runs in validation, from the files' owner, group and mode against openbao_user and openbao_group, before anything changes; prepare proves it on the fresh host. Also from review: - a seal status read that fails names the 127.0.0.1 IP SAN and openbao_tls_ca_file instead of a raw SSL error - :: gets the loopback listener too: it reaches 127.0.0.1 only while net.ipv6.bindv6only is 0 - the listen address check rejects strings such as ... or ::: - the TLS-disabled warning is registered, and verify asserts it - a missing binary under --skip-tags install fails with a clear message - the README names openbao_user and openbao_group and says the always tagged prereqs run under --tags health too Refs: #536 Assisted-by: Claude Code
41 lines
2.7 KiB
YAML
41 lines
2.7 KiB
YAML
---
|
|
# One failing run: runs the main entry point with the inputs of the case and asserts that the
|
|
# expected message, not something else, stopped it. Input: openbao_test_case (name, vars,
|
|
# expect). Task vars cannot come from a template as a whole, so each input a case may change is
|
|
# passed with its scenario value as the default.
|
|
- name: "Run the role, case {{ openbao_test_case.name }}"
|
|
block:
|
|
- name: "Include the role, case {{ openbao_test_case.name }}"
|
|
ansible.builtin.include_role:
|
|
name: mortis.kamino.openbao
|
|
vars:
|
|
openbao_version: "{{ openbao_test_case.vars.openbao_version | default(openbao_test_defaults.openbao_version) }}"
|
|
openbao_sha256: "{{ openbao_test_case.vars.openbao_sha256 | default(openbao_test_defaults.openbao_sha256) }}"
|
|
openbao_bin_path: "{{ openbao_test_case.vars.openbao_bin_path | default('/usr/local/bin/bao') }}"
|
|
openbao_listen_address: "{{ openbao_test_case.vars.openbao_listen_address | default('0.0.0.0') }}"
|
|
openbao_port: "{{ openbao_test_case.vars.openbao_port | default(8200) }}"
|
|
openbao_cluster_port: "{{ openbao_test_case.vars.openbao_cluster_port | default(8201) }}"
|
|
openbao_node_id: "{{ openbao_test_case.vars.openbao_node_id | default(inventory_hostname) }}"
|
|
openbao_cluster_addr: "{{ openbao_test_case.vars.openbao_cluster_addr | default('https://' ~ inventory_hostname ~ ':8201') }}"
|
|
openbao_tls_cert_file: "{{ openbao_test_case.vars.openbao_tls_cert_file | default(openbao_test_tls_dir ~ '/server.crt') }}"
|
|
openbao_tls_key_file: "{{ openbao_test_case.vars.openbao_tls_key_file | default(openbao_test_tls_dir ~ '/server.key') }}"
|
|
openbao_tls_ca_file: "{{ openbao_test_case.vars.openbao_tls_ca_file | default(openbao_test_tls_dir ~ '/ca.crt') }}"
|
|
openbao_tls_min_version: "{{ openbao_test_case.vars.openbao_tls_min_version | default('tls12') }}"
|
|
|
|
# Only reached when the include returned. The message must not contain the expected
|
|
# text, so the rescue below cannot mistake it for the failure under test.
|
|
- name: "Fail because the include returned, case {{ openbao_test_case.name }}"
|
|
ansible.builtin.fail:
|
|
msg: The role accepted the input
|
|
rescue:
|
|
# A failed loop task reports its message per item.
|
|
- name: "The expected failure stopped the run, case {{ openbao_test_case.name }}"
|
|
vars:
|
|
openbao_test_messages: >-
|
|
{{ (ansible_failed_result.msg | default('')) ~ ' '
|
|
~ (ansible_failed_result.results | default([]) | map(attribute='msg', default='') | join(' ')) }}
|
|
ansible.builtin.assert:
|
|
that: openbao_test_case.expect in openbao_test_messages
|
|
fail_msg: "Expected '{{ openbao_test_case.expect }}', got: {{ openbao_test_messages }}"
|
|
quiet: true
|