Skip to content

Commit

Permalink
Add test certificate and key to prepare.yml molecule
Browse files Browse the repository at this point in the history
  • Loading branch information
ruaridhg committed Dec 2, 2024
1 parent 8524d27 commit 710dec8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions roles/nginx/molecule/resources/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,29 @@
ansible.builtin.systemd:
name: gunicorn
state: restarted

- name: Add test certificates
hosts: all
become: true
tasks:
- name: Create the directory for Nginx certificates
ansible.builtin.file:
path: /etc/nginx/certs
state: directory
mode: "0700"
owner: nginx
group: nginx

- name: Generate test certificate
ansible.builtin.command:
cmd:
openssl req -new -x509 -key /etc/nginx/certs/test.key -out
/etc/nginx/certs/test.crt -days 365 -subj '/CN=example.com'
args:
creates: /etc/nginx/certs/test.crt

- name: Generate test private key
ansible.builtin.command:
cmd: openssl genrsa -out /etc/nginx/certs/test.key 2048
args:
creates: /etc/nginx/certs/test.key

0 comments on commit 710dec8

Please sign in to comment.