Commit Graph
19 Commits
Author SHA1 Message Date
volker.raschekandCopilot 625e93b524 fix: install cryptography via the distribution package manager
Installing the python cryptography bindings with ansible.builtin.pip is rejected by PEP 668 on distributions
which mark their python installation as externally managed. Fedora 38+, Ubuntu 23.04+ and RHEL 10 are
affected, so the role aborted on its very first task there.

The package names are resolved from vars/ via first_found, which keeps distribution specifics out of the
task file. vars/main.yaml provides python3-cryptography as a fallback for every family without a dedicated
file, Archlinux overrides it with python-cryptography.

Co-authored-by: Copilot <copilot@github.com>
2026-09-07 22:30:23 +02:00
volker.raschekandCopilot 8cc33a29ab refactor: remove circular pip installation task
The task named "Upgrade python package manager pip" installed pip with
`state: present`, which never upgrades anything, and it did so through
`ansible.builtin.pip`. That module already requires a working pip on the target,
so the task could only ever run when its own result was already satisfied.

Co-authored-by: Copilot <copilot@github.com>
2026-09-07 22:30:23 +02:00
volker.raschekandCopilot 2cd88df81b fix: report concatenation commands as unchanged
The `awk 1` commands assembling the chain, fullchain and all files declared
`changed_when: chain_content.rc == 0`, which holds on every successful run. As a
result the role never reported a converged state, even when no certificate was
touched.

These commands only read files and write to stdout, so mark them as unchanged.
The subsequent copy task remains responsible for reporting an actual change.

Co-authored-by: Copilot <copilot@github.com>
2026-09-07 22:30:23 +02:00
volker.raschekandCopilot a6e647b842 refactor: drop ineffective remote_src from copy tasks
All tasks writing the concatenated chain, fullchain and all files pass the file
body via `content`. The `remote_src` option only governs how `src` is resolved
and is ignored in that case, so it merely suggested a behaviour the tasks never
had.

Co-authored-by: Copilot <copilot@github.com>
2026-09-07 22:30:23 +02:00
volker.raschekandCopilot ad7b76852b feat: assert that the signing certificate authority is available
Issuing an intermediate certificate authority or a client certificate always
signs against the private key of the parent authority, regardless of whether
that authority is managed in the same run. With `certificate_authority_root_ca_skip`
or `certificate_authority_intermediate_ca_skip` enabled and no previously
provisioned key at the configured path, this surfaced as a generic module error
deep inside the signing task.

Stat the parent private key upfront and assert its presence, so the failure
names the missing path and the variables that control it. Skipping the parent
remains valid when its key already exists, because the check inspects the file
instead of the skip variable.

Co-authored-by: Copilot <copilot@github.com>
2026-09-07 22:30:23 +02:00
volker.raschekandCopilot 9ea26dc23f fix: resolve trust store location per distribution family
The trust store import hardcoded the RHEL anchor directory and
`update-ca-trust`, although `meta/main.yaml` also declares ArchLinux and Ubuntu
as supported platforms. On those distributions the task created a dangling
symlink outside any trust source and then failed on the missing binary.

Resolve both the anchor path and the update command from a map keyed by
`ansible_facts['os_family']`. Debian based systems additionally require the file
extension `crt`, because `update-ca-certificates` ignores anchors named
otherwise.

Note that the role now depends on gathered facts.

Co-authored-by: Copilot <copilot@github.com>
2026-09-07 22:30:23 +02:00
volker.raschekandCopilot 41d06e4e6d feat!: apply subject alternative names to root and intermediate CA
The variables `certificate_authority_root_ca_subject_alternative_names` and
`certificate_authority_intermediate_ca_subject_alternative_names` were
documented but never referenced by any task, so both CA certificates were always
issued without SANs. Wire them into the corresponding CSR tasks and fall back to
`omit` when the list is empty.

SAN entries are now passed to `openssl_csr` unchanged instead of being prefixed
with `DNS:` by the role. This allows other types such as `IP:` or `email:`,
which the previous rewrite would have corrupted into values like `DNS:IP:...`.
The client tasks additionally dropped `join(',') | quote`, because `quote`
performs shell escaping and `openssl_csr` expects a list.

Since both client CSR tasks only differed in `subject_alt_name`, they collapse
into a single task per file.

BREAKING CHANGE: Entries of all `*_subject_alternative_names` variables must now
carry their type prefix, for example `DNS:example.local` instead of
`example.local`.

Co-authored-by: Copilot <copilot@github.com>
2026-09-07 22:28:52 +02:00
volker.raschekandCopilot 38ab2f55bb fix: drop passphrase from CSR task for unencrypted client key
This task file is only included when
`certificate_authority_client_tls_key_passphrase` is empty, so the private key
is created without encryption. Passing the empty passphrase to `openssl_csr`
made the module attempt to decrypt an unencrypted key instead of treating it as
absent. The sibling CSR task for certificates with SANs already omitted the
attribute, so this also aligns both code paths.

Co-authored-by: Copilot <copilot@github.com>
2026-09-07 22:28:52 +02:00
volker.raschekandCopilot 309c5e0e65 fix: use client path instead of certificate content as destination
The task importing the client certificate passed
`certificate_authority_client_tls_crt_content` to `dest`, so the PEM payload
itself was interpreted as a directory path. The certificate was written to a
bogus location derived from its own content instead of the configured client
directory. Use `certificate_authority_client_path` as destination, consistent
with the private key import above.

Co-authored-by: Copilot <copilot@github.com>
2026-09-07 22:28:52 +02:00
volker.raschekandCopilot 32bd44a0a6 fix: use declared variable for client private key destination
The task importing the client private key referenced
`certificate_authority_client_ca_path`, a variable that is declared neither in
`defaults/main.yaml` nor in `meta/argument_specs.yaml`. Every run with
`certificate_authority_client_create: false` therefore aborted with an undefined
variable error before the key was written. Use the actual role variable
`certificate_authority_client_path` instead.

Co-authored-by: Copilot <copilot@github.com>
2026-09-07 22:28:52 +02:00
volker.raschek b112672d5a fix(tasks): create passphrase protected client certificate 2026-09-07 22:28:52 +02:00
volker.raschek 6208d55dcb fix(linter): be compliant with ansible-linter
Lint Markdown files / markdown-lint (push) Successful in 10s
Ansible Linter / ansible-lint (push) Successful in 33s
2025-08-06 10:55:42 +02:00
volker.raschek ef2c31e64e fix: remove state
Lint Markdown files / markdown-lint (push) Successful in 11s
Ansible Linter / ansible-lint (push) Failing after 41s
2025-07-31 19:08:10 +02:00
volker.raschek 1c40b1d59b feat: support further TLS certification properties
Lint Markdown files / markdown-lint (push) Successful in 10s
Ansible Linter / ansible-lint (push) Failing after 46s
2025-07-31 18:46:19 +02:00
volker.raschek c3fb49bbd4 fix(root_ca): set passphrase correctly
Lint Markdown files / markdown-lint (push) Successful in 13s
Ansible Linter / ansible-lint (push) Failing after 57s
2025-07-31 11:56:27 +02:00
volker.raschek 61b0a7c9ec fix: set cipher correctly
Ansible Linter / ansible-lint (push) Failing after 59s
Lint Markdown files / markdown-lint (push) Successful in 11s
2025-07-31 09:53:01 +02:00
volker.raschek dbbaacdc69 fix(root_ca): set passphrase correctly
Lint Markdown files / markdown-lint (push) Successful in 10s
Ansible Linter / ansible-lint (push) Failing after 1m0s
2025-07-31 09:49:12 +02:00
volker.raschek 505f0450d4 fix(intermediate_ca): set passphrase correctly
Lint Markdown files / markdown-lint (push) Has been cancelled
Ansible Linter / ansible-lint (push) Has been cancelled
2025-07-31 09:48:51 +02:00
volker.raschek a0ea59c528 Initial Commit
Lint Markdown files / markdown-lint (push) Successful in 11s
Ansible Linter / ansible-lint (push) Failing after 49s
2025-07-30 22:09:38 +02:00