2017-09-13 21:39:32 +00:00
|
|
|
- name: Validate certificate (test - privatekey modulus)
|
2017-12-12 12:35:22 +00:00
|
|
|
shell: 'openssl rsa -noout -modulus -in {{ output_dir }}/privatekey.pem'
|
2017-09-13 21:39:32 +00:00
|
|
|
register: privatekey_modulus
|
|
|
|
|
|
|
|
- name: Validate certificate (test - certificate modulus)
|
2017-12-12 12:35:22 +00:00
|
|
|
shell: 'openssl x509 -noout -modulus -in {{ output_dir }}/cert.pem'
|
2017-09-13 21:39:32 +00:00
|
|
|
register: cert_modulus
|
|
|
|
|
2018-01-18 13:35:05 +00:00
|
|
|
- name: Validate certificate (test - issuer value)
|
2018-04-04 21:34:31 +00:00
|
|
|
shell: 'openssl x509 -noout -in {{ output_dir}}/cert.pem -text | grep "Issuer" | sed "s/.*: \(.*\)/\1/g; s/ //g;"'
|
2018-01-18 13:35:05 +00:00
|
|
|
register: cert_issuer
|
|
|
|
|
|
|
|
|
2017-09-14 13:21:32 +00:00
|
|
|
- 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
|
|
|
|
|
2017-09-13 21:39:32 +00:00
|
|
|
- name: Validate certificate (assert)
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- cert_modulus.stdout == privatekey_modulus.stdout
|
2017-09-14 13:21:32 +00:00
|
|
|
- cert_version.stdout == '3'
|
2018-01-18 13:35:05 +00:00
|
|
|
- cert_issuer.stdout == 'CN=www.example.com'
|
2017-09-14 13:21:32 +00:00
|
|
|
|
2017-12-18 09:04:34 +00:00
|
|
|
- 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
|
|
|
|
|
2017-09-14 13:21:32 +00:00
|
|
|
- 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'
|
2017-09-13 21:39:32 +00:00
|
|
|
|
|
|
|
- name: Validate certificate2 (test - privatekey modulus)
|
2017-12-12 12:35:22 +00:00
|
|
|
shell: 'openssl rsa -noout -modulus -in {{ output_dir }}/privatekey2.pem'
|
2017-09-13 21:39:32 +00:00
|
|
|
register: privatekey2_modulus
|
|
|
|
|
|
|
|
- name: Validate certificate2 (test - certificate modulus)
|
2017-12-12 12:35:22 +00:00
|
|
|
shell: 'openssl x509 -noout -modulus -in {{ output_dir }}/cert2.pem'
|
2017-09-13 21:39:32 +00:00
|
|
|
register: cert2_modulus
|
|
|
|
|
|
|
|
- name: Validate certificate2 (assert)
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- cert2_modulus.stdout == privatekey2_modulus.stdout
|