fix bugs&add new roles&update ssl generate

This commit is contained in:
2024-12-08 22:42:36 +03:00
parent 1dabbe0f6f
commit 398de4dcc8
5 changed files with 58 additions and 6 deletions

View File

@ -1,10 +1,10 @@
- name: Install OpenSSL
zypper:
ansible.builtin.zypper:
name: openssl
state: present
- name: Create SSL directory
file:
ansible.builtin.file:
path: "{{ ssl_cert_path }}"
state: directory
owner: root
@ -18,10 +18,21 @@
type: RSA
mode: '0600'
- name: Generate CSR (Certificate Signing Request)
community.crypto.openssl_csr:
path: "{{ ssl_cert_path }}/{{ ssl_csr_file }}"
privatekey_path: "{{ ssl_cert_path }}/{{ ssl_key_file }}"
common_name: "{{ ssl_common_name }}"
country_name: "{{ ssl_country }}"
state_or_province_name: "{{ ssl_state }}"
locality_name: "{{ ssl_locality }}"
organization_name: "{{ ssl_organization }}"
organizational_unit_name: "{{ ssl_organizational_unit }}"
- 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
csr_path: "{{ ssl_cert_path }}/{{ ssl_csr_file }}"
provider: selfsigned
force: yes

View File

@ -1,4 +1,11 @@
ssl_cert_path: "/etc/nginx/ssl"
ssl_cert_file: "proxy.crt"
ssl_key_file: "proxy.key"
ssl_subject: "/C=RU/ST=Some-State/L=Some-City/O=Your Company/CN={{ proxy.proxy_domain }}"
ssl_csr_file: "proxy.csr"
ssl_common_name: "{{ proxy.proxy_domain }}"
ssl_country: "RU"
ssl_state: "Some-State"
ssl_locality: "Some-City"
ssl_organization: "Your Company"
ssl_organizational_unit: "IT"