From 1dc7125bde064127c1dfcb1f4ebcc436ea56aa94 Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 4 Jul 2020 15:10:01 +0200 Subject: [PATCH] chang mail to ssmtp --- README.md | 2 +- group_vars/server | 9 ++++---- msmtp.yml | 3 +++ roles/ssmtp/defaults/main.yml | 5 ----- roles/ssmtp/files/main.yml | 0 roles/ssmtp/handlers/main.yml | 0 roles/ssmtp/meta/main.yml | 0 roles/ssmtp/tasks/main.yml | 35 ----------------------------- roles/ssmtp/templates/main.yml | 0 roles/ssmtp/templates/revaliases.j2 | 3 --- roles/ssmtp/templates/ssmtp_conf.j2 | 12 ---------- roles/ssmtp/vars/main.yml | 0 server.yml | 2 +- 13 files changed, 9 insertions(+), 62 deletions(-) create mode 100644 msmtp.yml delete mode 100644 roles/ssmtp/defaults/main.yml delete mode 100644 roles/ssmtp/files/main.yml delete mode 100644 roles/ssmtp/handlers/main.yml delete mode 100644 roles/ssmtp/meta/main.yml delete mode 100644 roles/ssmtp/tasks/main.yml delete mode 100644 roles/ssmtp/templates/main.yml delete mode 100644 roles/ssmtp/templates/revaliases.j2 delete mode 100644 roles/ssmtp/templates/ssmtp_conf.j2 delete mode 100644 roles/ssmtp/vars/main.yml diff --git a/README.md b/README.md index 02065a6..ac956d1 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ - server role - [x] cron - - [x] ssmtp + - [x] msmtp - [x] rsyncd role diff --git a/group_vars/server b/group_vars/server index 1ca653b..ac8bcd9 100644 --- a/group_vars/server +++ b/group_vars/server @@ -80,11 +80,10 @@ syncthing_address: "0.0.0.0:8384" syncthing_gui_user: "{{user.name}}" syncthing_gui_password: $2a$10$nJZ8YN/1mB84Cbi79BKka.6SFMAKF.CBwyCNJDA9qUgXdkcuBilx2 -notification_mail: "{{ user.mail }}" -ssmtp_mailhub: smtp.{{ domain.name }}:587 -ssmtp_hostname: "{{ domain.name }}" -ssmtp_auth_user: "{{ user.mail }}" -ssmtp_auth_pass: "{{ vault_default_password }}" +notification_mail: "{{inventory_hostname}}@{{ domain.name }}" +msmtp_mailhub: smtp.{{ domain.name }} +msmtp_auth_user: "{{ user.mail }}" +msmtp_auth_pass: "{{ vault_default_password }}" rsynclocations: - name: backup nas diff --git a/msmtp.yml b/msmtp.yml new file mode 100644 index 0000000..84becc5 --- /dev/null +++ b/msmtp.yml @@ -0,0 +1,3 @@ +- hosts: server + roles: + - msmtp diff --git a/roles/ssmtp/defaults/main.yml b/roles/ssmtp/defaults/main.yml deleted file mode 100644 index 3b30209..0000000 --- a/roles/ssmtp/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -notification_mail: "{{inventory_hostname}}@ducamps.win" -ssmtp_mailhub: smtp.ducamps.win:587 -ssmtp_hostname: ducamps.win -ssmtp_auth_user: vincent@ducamps.win -ssmtp_auth_pass: the_mandrill_api_key diff --git a/roles/ssmtp/files/main.yml b/roles/ssmtp/files/main.yml deleted file mode 100644 index e69de29..0000000 diff --git a/roles/ssmtp/handlers/main.yml b/roles/ssmtp/handlers/main.yml deleted file mode 100644 index e69de29..0000000 diff --git a/roles/ssmtp/meta/main.yml b/roles/ssmtp/meta/main.yml deleted file mode 100644 index e69de29..0000000 diff --git a/roles/ssmtp/tasks/main.yml b/roles/ssmtp/tasks/main.yml deleted file mode 100644 index 8cbf100..0000000 --- a/roles/ssmtp/tasks/main.yml +++ /dev/null @@ -1,35 +0,0 @@ - -- name: Install SSMTP - aur: name=ssmtp state=present - become_user: aur_builder - - -- name: Set up ssmtp.conf - template: - src: ssmtp_conf.j2 - dest: /etc/ssmtp/ssmtp.conf - owner: root - group: mail - mode: 0640 - become: yes - -- name: Set up revaliases - template: - src: revaliases.j2 - dest: /etc/ssmtp/revaliases - owner: root - group: mail - mode: 0640 - become: yes - -- name: set right on /usr/sbin/ssmtp - file: - path: /usr/sbin/ssmtp # required. Path to the file being managed. - group: mail # not required. Name of the group that should own the file/directory, as would be fed to I(chown). - mode: 2711 # not required. Mode the file or directory should be. For those used to I(/usr/bin/chmod) remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like C(0644) or C(01777)) or quote it (like C('644') or C('1777')) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of version 1.8, the mode may be specified as a symbolic mode (for example, C(u+rwx) or C(u=rw,g=r,o=r)). - owner: root # not required. Name of the user that should own the file/directory, as would be fed to I(chown). - become: yes - -#sudo chown root:mail /usr/sbin/ssmtp /etc/ssmtp{,/{ssmtp.conf,revaliases}} -#sudo chmod 2711 /usr/sbin/ssmtp -#sudo chmod o-rwx /etc/ssmtp /etc/ssmtp/ssmtp.conf; \ No newline at end of file diff --git a/roles/ssmtp/templates/main.yml b/roles/ssmtp/templates/main.yml deleted file mode 100644 index e69de29..0000000 diff --git a/roles/ssmtp/templates/revaliases.j2 b/roles/ssmtp/templates/revaliases.j2 deleted file mode 100644 index d2dac30..0000000 --- a/roles/ssmtp/templates/revaliases.j2 +++ /dev/null @@ -1,3 +0,0 @@ - -root:{{ notification_mail }}:{{ ssmtp_mailhub }} -{{ user.name }}:{{ notification_mail }}:{{ ssmtp_mailhub }} \ No newline at end of file diff --git a/roles/ssmtp/templates/ssmtp_conf.j2 b/roles/ssmtp/templates/ssmtp_conf.j2 deleted file mode 100644 index c4d14bd..0000000 --- a/roles/ssmtp/templates/ssmtp_conf.j2 +++ /dev/null @@ -1,12 +0,0 @@ - -# ---- basic config -root={{ssmtp_auth_user}} -AuthMethod=LOGIN -UseSTARTTLS=Yes -UseTLS=NO -hostname={{ssmtp_hostname}} -FromLineOverride=Yes - -AuthUser={{ ssmtp_auth_user }} -mailhub={{ ssmtp_mailhub }} -AuthPass={{ ssmtp_auth_pass }} diff --git a/roles/ssmtp/vars/main.yml b/roles/ssmtp/vars/main.yml deleted file mode 100644 index e69de29..0000000 diff --git a/server.yml b/server.yml index ac01941..d7023d9 100644 --- a/server.yml +++ b/server.yml @@ -10,7 +10,7 @@ roles: - syncthing - - ssmtp + - msmtp - cronie - rsyncd - gandi-dyn-dns