a2b00e9b52
Ensure the Issuer field of the certificate is set when using the selfsigned backend. Fixes: https://github.com/ansible/ansible/issues/34963
52 lines
2 KiB
YAML
52 lines
2 KiB
YAML
- name: Validate certificate (test - privatekey modulus)
|
|
shell: 'openssl rsa -noout -modulus -in {{ output_dir }}/privatekey.pem'
|
|
register: privatekey_modulus
|
|
|
|
- name: Validate certificate (test - certificate modulus)
|
|
shell: 'openssl x509 -noout -modulus -in {{ output_dir }}/cert.pem'
|
|
register: cert_modulus
|
|
|
|
- name: Validate certificate (test - issuer value)
|
|
shell: 'openssl x509 -noout -in {{ output_dir}}/cert.pem -text | grep "Issuer" | sed "s/.*: \(.*\)/\1/g"'
|
|
register: cert_issuer
|
|
|
|
|
|
- name: Validate certificate (test - certficate version == default == 3)
|
|
shell: 'openssl x509 -noout -in {{ output_dir}}/cert.pem -text | grep "Version" | sed "s/.*: \(.*\) .*/\1/g"'
|
|
register: cert_version
|
|
|
|
- name: Validate certificate (assert)
|
|
assert:
|
|
that:
|
|
- cert_modulus.stdout == privatekey_modulus.stdout
|
|
- cert_version.stdout == '3'
|
|
- cert_issuer.stdout == 'CN=www.example.com'
|
|
|
|
- name: Validate certificate idempotence
|
|
assert:
|
|
that:
|
|
- selfsigned_certificate.serial_number == selfsigned_certificate_idempotence.serial_number
|
|
- selfsigned_certificate.notBefore == selfsigned_certificate_idempotence.notBefore
|
|
- selfsigned_certificate.notAfter == selfsigned_certificate_idempotence.notAfter
|
|
|
|
- name: Validate certificate v2 (test - certificate version == 2)
|
|
shell: 'openssl x509 -noout -in {{ output_dir}}/cert_v2.pem -text | grep "Version" | sed "s/.*: \(.*\) .*/\1/g"'
|
|
register: cert_v2_version
|
|
|
|
- name: Validate certificate version 2 (assert)
|
|
assert:
|
|
that:
|
|
- cert_v2_version.stdout == '2'
|
|
|
|
- name: Validate certificate2 (test - privatekey modulus)
|
|
shell: 'openssl rsa -noout -modulus -in {{ output_dir }}/privatekey2.pem'
|
|
register: privatekey2_modulus
|
|
|
|
- name: Validate certificate2 (test - certificate modulus)
|
|
shell: 'openssl x509 -noout -modulus -in {{ output_dir }}/cert2.pem'
|
|
register: cert2_modulus
|
|
|
|
- name: Validate certificate2 (assert)
|
|
assert:
|
|
that:
|
|
- cert2_modulus.stdout == privatekey2_modulus.stdout
|