Repository navigation
feat: Remove command to use x509_certificate_convert module in mtv_pr… - #124
Conversation
5629068 to
46e2ef1
Compare
tech2734
left a comment
There was a problem hiding this comment.
Approved — tested against homelab vCenter (AAP job #320 successful).
Clean, well-scoped improvement:
community.crypto.x509_certificate_convertreplaces theopenssl x509shell-out, removing the binary dependency and thechanged_when: falseworkaround- The
always:block for temp file cleanup is a nice addition — previously the DER file lingered in/tmp community.crypto >= 2.26.0is already a collection dependency so the module is guaranteed available
VMCA DER→PEM conversion and provider creation both passed on a live vCenter environment.
46e2ef1 to
c649569
Compare
|
Thanks for the clean, well-scoped PR — CI green, and the temp-file cleanup is a nice addition. Findings from a dual (devops + security) review of the delta: Direction note. The maintainer side is aligned with the module direction — PR #120 (a justification comment for the old command) will be closed as superseded by this PR, and the workspace conventions are being updated to match. No action needed from you on that. TRACK: trailing-newline claim. The old code stored TRACK: bare TRACK: changelog fragment missing (required per CONTRIBUTING). NOTE: per-run change reporting — since NOTE: unused register — Security: clean — no secrets in the delta; the cleanup is a net improvement. Two pre-existing items for separate awareness: fixed |
…ovider Signed-off-by: Andrew Block <andy.block@gmail.com>
c649569 to
6aec099
Compare
Addressed most of your concerns |
vvaldez
left a comment
There was a problem hiding this comment.
Re-reviewed the squashed head (6aec099):
- Bare
itemloop renamed vialoop_control.loop_var(conventions compliant) - Changelog fragment added;
changelog-lintgreen - Unused
registerdropped
Live test against pool1 passed end to end: the new community.crypto.x509_certificate_convert path ran green and the provider CR reached ConnectionTestSucceeded, Validated, InventoryCreated. The trailing-newline wording in the body has nil impact (the consumer tolerates either); fine to leave as-is.
Approving.
What
Replaces the
openssl x509shell command in themtv_providerrole with thecommunity.crypto.x509_certificate_convertmodule and cleans up temporary certificate files after use.Why
The
mtv_providerrole downloads the vCenter VMCA CA certificate in DER format and converts it to PEM. The conversion previously shelled out toopensslviaansible.builtin.command, which depends on theopensslbinary being present on the execution environment and bypasses Ansible's module behaviors (idempotency, structured results, native change reporting). Using the dedicatedcommunity.crypto.x509_certificate_convertmodule aligns with Ansible best practices and is already satisfied by the collection's existingcommunity.crypto >= 2.26.0dependency. Additionally, the temporary DER and PEM files were left behind in/tmpon the execution environment; they are now removed when the block completes.Changes
roles/mtv_provider/tasks/validate.ymlansible.builtin.commandtask runningopenssl x509 -inform DER -in ... -outform PEMwith thecommunity.crypto.x509_certificate_convertmodule (format: pem), removing thechanged_when: falseworkaround since the module reports change state natively and is idempotent_mtv_provider_vmca_pem_pathvariable for the converted PEM output, mirroring the existing DER path variablelookup('ansible.builtin.file', ...)instead of capturing command stdout, preserving the trailing newline behavior expected by the provider secret templatealways:section to the VMCA block that removes both temporary certificate files (/tmp/.mtv_provider_vmca_ca.derand/tmp/.mtv_provider_vmca_ca.pem) on both success and rescue pathsroles/mtv_provider/README.md