Skip to content

Commit d5b6548

Browse files
committed
Add server certificate to CA certs on dev
So that MSL-API can connect to CKAN on local development environment, without having to disable TLS validation.
1 parent 115d0bb commit d5b6548

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

roles/msl_api/tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@
1111
ansible.builtin.import_tasks: storage.yml
1212
- name: Configure MSL-API
1313
ansible.builtin.import_tasks: config.yml
14+
- name: Add self-signed certificate to CA certificate file on development
15+
ansible.builtin.import_tasks: update-cacerts.yml
16+
when: epos_msl_environment == "development"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
# copyright Utrecht University
3+
4+
- name: Check whether local certificate has already been added to the CA certificates
5+
ansible.builtin.stat:
6+
path: /etc/ssl/certs/ca-certificates_updated.txt
7+
register: msl_api_certs_updated
8+
9+
10+
- name: Add local certificate to CA certificates
11+
ansible.builtin.shell:
12+
cmd: "tee -a /etc/ssl/certs/ca-certificates.crt < /etc/ssl/certs/localhost_and_chain.crt"
13+
when: not msl_api_certs_updated.stat.exists
14+
15+
16+
- name: Add file to record CA certificates have been updated
17+
ansible.builtin.file:
18+
path: /etc/ssl/certs/ca-certificates_updated.txt
19+
state: touch
20+
mode: "0644"
21+
when: not msl_api_certs_updated.stat.exists

0 commit comments

Comments
 (0)