The role was only linted statically so far, which is why every bug of the recent analysis passed the ci unnoticed. The scenario converges the role in podman containers of Archlinux, Debian and Fedora, checks idempotence and then verifies the result. Verification covers the chain via openssl verify, the file modes of keys, certificates and directories, the number of certificates in the fullchain of the client, its subject alternative names and the anchor in the systems trust store. Root and intermediate use a passphrase so the protected code paths are exercised as well. Molecule ships only the default driver, so create and destroy are provided as playbooks. Three details were needed to make it work. The connection has to be declared in the instance config, since molecule ignores ansible_connection_options of the driver. Raw commands are passed through sh explicitly, because the podman connection plugin splits them instead of using a shell. And the roles path has to point at the parent of the project directory, which is the role itself. Co-authored-by: Copilot <copilot@github.com>
23 lines
816 B
YAML
23 lines
816 B
YAML
---
|
|
|
|
- name: Prepare
|
|
hosts: all
|
|
gather_facts: false
|
|
vars:
|
|
# The base images ship neither a python interpreter for ansible nor the tools the role shells out to.
|
|
_bootstrap: |
|
|
set -eu
|
|
if command -v pacman > /dev/null; then
|
|
pacman --sync --refresh --noconfirm ca-certificates gawk openssl python
|
|
elif command -v apt-get > /dev/null; then
|
|
apt-get update
|
|
apt-get install --yes ca-certificates gawk openssl python3
|
|
else
|
|
dnf install --assumeyes ca-certificates gawk openssl python3
|
|
fi
|
|
tasks:
|
|
# The podman connection plugin splits raw commands instead of passing them to a shell.
|
|
- name: Bootstrap the python interpreter and the tools required by the role
|
|
ansible.builtin.raw: "/bin/sh -c {{ _bootstrap | quote }}"
|
|
changed_when: true
|