Files
computer-playbook/roles/web-app-stalwart/tasks/05_tls/activate.yml

26 lines
1.2 KiB
YAML

---
# include-gated: when: stalwart_cert_missing | bool
- name: "🔧 Register the platform TLS certificate with Stalwart"
include_tasks: "{{ role_path }}/tasks/jmap_call.yml"
vars:
stalwart_jmap_body: >-
{{ {'using': ['urn:ietf:params:jmap:core', 'urn:stalwart:jmap'],
'methodCalls': [['x:Certificate/set', {'create': {'c': {
'certificate': {'@type': 'File', 'filePath': '/etc/stalwart/certs/cert.pem'},
'privateKey': {'@type': 'File', 'filePath': '/etc/stalwart/certs/key.pem'}
}}}, 'c0']]} | to_json }}
- name: "🔄 Restart Stalwart to activate the registered certificate (compose)"
ansible.builtin.command: "container restart {{ STALWART_CONTAINER }}"
changed_when: true
when: DEPLOYMENT_MODE == 'compose'
- name: "🔄 Restart Stalwart to activate the registered certificate (swarm)"
ansible.builtin.command: "container service update --force {{ lookup('container_service', application_id, 'stalwart') }}"
changed_when: true
timeout: "{{ lookup('timeout', 600) | int }}"
when: DEPLOYMENT_MODE == 'swarm'
- name: "⏳ Wait for Stalwart API after the certificate restart"
include_tasks: "{{ role_path }}/tasks/01_wait_for_api.yml"