diff --git a/roles/msl_api/tasks/main.yml b/roles/msl_api/tasks/main.yml index ebd4ad9..17c0a4f 100644 --- a/roles/msl_api/tasks/main.yml +++ b/roles/msl_api/tasks/main.yml @@ -11,3 +11,6 @@ ansible.builtin.import_tasks: storage.yml - name: Configure MSL-API ansible.builtin.import_tasks: config.yml +- name: Add self-signed certificate to CA certificate file on development + ansible.builtin.import_tasks: update-cacerts.yml + when: epos_msl_environment == "development" diff --git a/roles/msl_api/tasks/update-cacerts.yml b/roles/msl_api/tasks/update-cacerts.yml new file mode 100644 index 0000000..2020d0b --- /dev/null +++ b/roles/msl_api/tasks/update-cacerts.yml @@ -0,0 +1,21 @@ +--- +# copyright Utrecht University + +- name: Check whether local certificate has already been added to the CA certificates + ansible.builtin.stat: + path: /etc/ssl/certs/ca-certificates_updated.txt + register: msl_api_certs_updated + + +- name: Add local certificate to CA certificates + ansible.builtin.shell: + cmd: "tee -a /etc/ssl/certs/ca-certificates.crt < /etc/ssl/certs/localhost_and_chain.crt" + when: not msl_api_certs_updated.stat.exists + + +- name: Add file to record CA certificates have been updated + ansible.builtin.file: + path: /etc/ssl/certs/ca-certificates_updated.txt + state: touch + mode: "0644" + when: not msl_api_certs_updated.stat.exists