Files
computer-playbook/roles/sys-svc-msmtp/tasks/01_core.yml

45 lines
1.2 KiB
YAML

- include_tasks: utils/once_flag.yml
- name: "Check if Mail Host is reachable"
uri:
url: "{{ WEB_PROTOCOL ~ '://' ~ SYSTEM_EMAIL.HOST }}"
method: HEAD
validate_certs: yes
status_code: [200, 301, 302]
register: mail_host_reachability
failed_when: false
changed_when: false
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
when:
- run_once_web_app_mailu is not defined
- "{{ 'web-app-mailu' in group_names }}"
- SYSTEM_EMAIL.HOST == domains | get_domain('web-app-mailu')
- name: "Load Mailu Routines for '{{ role_name }}'"
include_tasks: 02_mailu.yml
when:
- "'web-app-mailu' in group_names"
- >
(mail_host_reachability is defined and
(mail_host_reachability.status | default(0)) not in [200, 301, 302])
or
not (users['no-reply'].mailu_token | default(false) | bool)
- name: install msmtp msmtp-mta
community.general.pacman:
name:
- msmtp
- msmtp-mta
state: present
- name: configure msmtprc.conf.j2
template:
src: "msmtprc.conf.j2"
dest: "/root/.msmtprc"
mode: 600
- include_role:
name: sys-ctl-hlth-msmtp
when: run_once_sys_ctl_hlth_msmtp is not defined
- include_tasks: utils/compose_up.yml