mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
5bb5c9d295
* Update for #54298: Certificate is abstract, so instantiating doesn't work. * Add test for removal.
50 lines
1.7 KiB
YAML
50 lines
1.7 KiB
YAML
---
|
|
- name: (Removal, {{select_crypto_backend}}) Generate privatekey
|
|
openssl_privatekey:
|
|
path: '{{ output_dir }}/removal_privatekey.pem'
|
|
|
|
- name: (Removal, {{select_crypto_backend}}) Generate CSR
|
|
openssl_csr:
|
|
path: '{{ output_dir }}/removal_csr.csr'
|
|
privatekey_path: '{{ output_dir }}/removal_privatekey.pem'
|
|
|
|
- name: (Removal, {{select_crypto_backend}}) Generate selfsigned certificate
|
|
openssl_certificate:
|
|
path: '{{ output_dir }}/removal_cert.pem'
|
|
csr_path: '{{ output_dir }}/removal_csr.csr'
|
|
privatekey_path: '{{ output_dir }}/removal_privatekey.pem'
|
|
provider: selfsigned
|
|
selfsigned_digest: sha256
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
- name: "(Removal, {{select_crypto_backend}}) Check that file is not gone"
|
|
stat:
|
|
path: "{{ output_dir }}/removal_cert.pem"
|
|
register: removal_1_prestat
|
|
|
|
- name: "(Removal, {{select_crypto_backend}}) Remove certificate"
|
|
openssl_certificate:
|
|
path: "{{ output_dir }}/removal_cert.pem"
|
|
state: absent
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
register: removal_1
|
|
|
|
- name: "(Removal, {{select_crypto_backend}}) Check that file is gone"
|
|
stat:
|
|
path: "{{ output_dir }}/removal_cert.pem"
|
|
register: removal_1_poststat
|
|
|
|
- name: "(Removal, {{select_crypto_backend}}) Remove certificate (idempotent)"
|
|
openssl_certificate:
|
|
path: "{{ output_dir }}/removal_cert.pem"
|
|
state: absent
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
register: removal_2
|
|
|
|
- name: (Removal, {{select_crypto_backend}}) Ensure removal worked
|
|
assert:
|
|
that:
|
|
- removal_1_prestat.stat.exists
|
|
- removal_1 is changed
|
|
- not removal_1_poststat.stat.exists
|
|
- removal_2 is not changed
|