From 2e3d7d180d3725da8e9604c1a0643c4cdce81f5d Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 10 Sep 2024 10:11:13 +0200 Subject: [PATCH] proxmox: set mail relay --- roles/proxmox/handlers/main.yml | 6 ++++++ roles/proxmox/tasks/main.yml | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/roles/proxmox/handlers/main.yml b/roles/proxmox/handlers/main.yml index 330874b..f422af1 100644 --- a/roles/proxmox/handlers/main.yml +++ b/roles/proxmox/handlers/main.yml @@ -6,6 +6,12 @@ command: ifreload -a when: "'handler' not in ansible_skip_tags" +- name: reload postfix + service: + name: postfix + state: reloaded + when: "'handler' not in ansible_skip_tags" + - name: update package cache package: update_cache: yes diff --git a/roles/proxmox/tasks/main.yml b/roles/proxmox/tasks/main.yml index 64ee9f7..a7ede66 100644 --- a/roles/proxmox/tasks/main.yml +++ b/roles/proxmox/tasks/main.yml @@ -57,6 +57,13 @@ | sort | unique | join(";") }}' changed_when: false # maybe write a proper check if certificate requests are ever ansibled +- name: Set SMTP relay + lineinfile: + path: /etc/postfix/main.cf + regexp: '^relayhost =' + line: 'relayhost = {{ mail_relay | default("") }}' + notify: reload postfix + - include_tasks: firewall.yml - include_tasks: user.yml