coursework/ansible/roles/ssl_certificate/tasks/main.yml

27 lines
644 B
YAML
Raw Normal View History

2024-12-08 18:23:31 +00:00
- name: Install OpenSSL
zypper:
name: openssl
state: present
- name: Create SSL directory
file:
path: "{{ ssl_cert_path }}"
state: directory
owner: root
group: root
mode: '0755'
- name: Generate private key
community.crypto.openssl_privatekey:
path: "{{ ssl_cert_path }}/{{ ssl_key_file }}"
size: 2048
type: RSA
mode: '0600'
- name: Generate Self-Signed SSL Certificate
community.crypto.x509_certificate:
path: "{{ ssl_cert_path }}/{{ ssl_cert_file }}"
privatekey_path: "{{ ssl_cert_path }}/{{ ssl_key_file }}"
subject: "{{ ssl_subject }}"
provider: "openssl"
days: 365