Skip to content

Commit 6ed7bb4

Browse files
authored
[14 Aug 2025] - [Ansible] Generate CSR Playbook (#19)
* [Ansible] Generate CSR Playbook * Update generate-csr.yaml * Fix typo 'private_key_path' * Add Comment
1 parent 09083e5 commit 6ed7bb4

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
- name: Generate CSR
3+
hosts: localhost
4+
gather_facts: false
5+
vars:
6+
csr_path: "<example.tld>_csr.pem" # Change to domain you will have to create CSR for
7+
private_key_path: "<example.tld>_key.pem" # Change to domain you will have to create CSR for
8+
common_name: "*.<example.tld>" # Change to domain you will have to create CSR for
9+
tasks:
10+
- name: Create directory
11+
file:
12+
path: "certificate/"
13+
state: directory
14+
mode: '0755'
15+
16+
- name: Generate private key
17+
openssl_privatekey:
18+
path: "./certificate/{{ private_key_path }}"
19+
size: 2048
20+
register: private_key
21+
22+
- name: Generate CSR
23+
openssl_csr:
24+
path: "./certificate/{{ csr_path }}"
25+
privatekey_path: "./certificate/{{ private_key_path }}"
26+
common_name: "{{ common_name }}"
27+
organization_name: "<org name>"
28+
organizational_unit_name: "<org ou>"
29+
country_name: "<country code>"
30+
locality_name: "<local area>"
31+
state_or_province_name: "<state>"
32+
email_address: "<mail@example.tld"
33+
backup: yes
34+
register: csr
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ansible==10.3.0
2+
ansible-core==2.17.3
3+
cryptography==43.0.0

0 commit comments

Comments
 (0)