From 0b75fc3a697fca057a0e773217e0e0b34517b41c Mon Sep 17 00:00:00 2001 From: nd Date: Mon, 13 Apr 2020 16:41:27 +0200 Subject: [PATCH] moved more to nullmailer --- defaults/main.yml | 1 + tasks/main.yml | 6 ++++-- tasks/nullmailer.yml | 10 ++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index fd90004..3713d7b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,3 +2,4 @@ mail: root: "root@example.com" server: "mail.example.com" domain: "example.com" + backend: nullmailer diff --git a/tasks/main.yml b/tasks/main.yml index a781495..3f9d183 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,6 @@ - include_tasks: ssmtp.yml - when: ansible_distribution_release == "stretch" + when: + - ansible_distribution_release == "stretch" + - mail.backend == "ssmtp" - include_tasks: nullmailer.yml - when: ansible_distribution_release != "stretch" + when: (ansible_distribution_release != "stretch" or mail.backend != "ssmtp") diff --git a/tasks/nullmailer.yml b/tasks/nullmailer.yml index 70c0554..2a73047 100644 --- a/tasks/nullmailer.yml +++ b/tasks/nullmailer.yml @@ -2,6 +2,16 @@ apt: pkg: nullmailer +- name: remove ssmtp + apt: + pkg: ssmtp + state: absent + +- name: remove ssmtp config + file: + path: /etc/ssmtp/ssmtp.conf + state: absent + - name: setup nullmailer notify: restart nullmailer copy: