mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-12-03 16:09:29 +00:00
- Replace status_code [200,301,302] with explicit 'status_code: 200' - Use '(status | default(0) | int) != 200' for consistent reachability detection - Remove deprecated Jinja usage inside when-conditions - Replace string-rendered conditions with native boolean checks - Improve Mailu routine trigger logic by tightening status evaluation - Cleanup unused no_log directives Reference: https://chatgpt.com/share/692f04b5-5698-800f-a355-9e9b70cf97d7
44 lines
1.1 KiB
YAML
44 lines
1.1 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
|
|
register: mail_host_reachability
|
|
failed_when: false
|
|
changed_when: false
|
|
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) | int) != 200)
|
|
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 |