mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-08 22:33:53 +00:00
* Fix fqcn[action-core].
* Fix fqcn[action].
* Fix jinja[spacing].
(cherry picked from commit 8792635bef)
58 lines
2.2 KiB
YAML
58 lines
2.2 KiB
YAML
---
|
|
# Copyright (c) Ansible Project
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
- name: (Removal, {{ select_crypto_backend }}) Generate privatekey
|
|
community.crypto.openssl_privatekey:
|
|
path: '{{ remote_tmp_dir }}/removal_privatekey.pem'
|
|
size: '{{ default_rsa_key_size_certificates }}'
|
|
|
|
- name: (Removal, {{ select_crypto_backend }}) Generate CSR
|
|
community.crypto.openssl_csr:
|
|
path: '{{ remote_tmp_dir }}/removal_csr.csr'
|
|
privatekey_path: '{{ remote_tmp_dir }}/removal_privatekey.pem'
|
|
|
|
- name: (Removal, {{ select_crypto_backend }}) Generate selfsigned certificate
|
|
community.crypto.x509_certificate:
|
|
path: '{{ remote_tmp_dir }}/removal_cert.pem'
|
|
csr_path: '{{ remote_tmp_dir }}/removal_csr.csr'
|
|
privatekey_path: '{{ remote_tmp_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"
|
|
ansible.builtin.stat:
|
|
path: "{{ remote_tmp_dir }}/removal_cert.pem"
|
|
register: removal_1_prestat
|
|
|
|
- name: "(Removal, {{ select_crypto_backend }}) Remove certificate"
|
|
community.crypto.x509_certificate:
|
|
path: "{{ remote_tmp_dir }}/removal_cert.pem"
|
|
state: absent
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
return_content: true
|
|
register: removal_1
|
|
|
|
- name: "(Removal, {{ select_crypto_backend }}) Check that file is gone"
|
|
ansible.builtin.stat:
|
|
path: "{{ remote_tmp_dir }}/removal_cert.pem"
|
|
register: removal_1_poststat
|
|
|
|
- name: "(Removal, {{ select_crypto_backend }}) Remove certificate (idempotent)"
|
|
community.crypto.x509_certificate:
|
|
path: "{{ remote_tmp_dir }}/removal_cert.pem"
|
|
state: absent
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
register: removal_2
|
|
|
|
- name: (Removal, {{ select_crypto_backend }}) Ensure removal worked
|
|
ansible.builtin.assert:
|
|
that:
|
|
- removal_1_prestat.stat.exists
|
|
- removal_1 is changed
|
|
- not removal_1_poststat.stat.exists
|
|
- removal_2 is not changed
|
|
- removal_1.certificate is none
|