2014-03-21 19:16:55 +00:00
|
|
|
---
|
2018-04-28 18:21:08 +00:00
|
|
|
# Deploy msmtp
|
|
|
|
- name: Update apt cache.
|
|
|
|
apt:
|
|
|
|
update_cache: yes
|
2018-05-07 14:26:30 +00:00
|
|
|
upgrade: no
|
2018-04-28 18:21:08 +00:00
|
|
|
cache_valid_time: 14400 # 4 hours
|
|
|
|
tags: mail
|
|
|
|
when: ansible_os_family == "Debian"
|
2014-03-21 19:16:55 +00:00
|
|
|
|
2018-04-28 18:21:08 +00:00
|
|
|
- name: Remove other MTAs.
|
|
|
|
apt:
|
|
|
|
pkg: "{{ item }}"
|
|
|
|
state: absent
|
|
|
|
autoremove: yes
|
|
|
|
purge: yes
|
|
|
|
with_items:
|
|
|
|
- exim4*
|
|
|
|
- postfix*
|
|
|
|
- sendmail*
|
|
|
|
tags:
|
|
|
|
- mail
|
2018-05-07 17:15:32 +00:00
|
|
|
when:
|
|
|
|
- msmtp_remove_mtas
|
|
|
|
- ansible_os_family == "Debian"
|
2018-04-28 18:21:08 +00:00
|
|
|
|
2018-05-07 08:31:19 +00:00
|
|
|
- name: Install msmtp and mailx on Debian.
|
2018-04-28 18:21:08 +00:00
|
|
|
apt:
|
|
|
|
pkg: "{{item}}"
|
|
|
|
state: present
|
|
|
|
with_items:
|
|
|
|
- msmtp-mta
|
|
|
|
- bsd-mailx
|
|
|
|
tags: mail
|
|
|
|
notify: test mail
|
|
|
|
when: ansible_os_family == "Debian"
|
|
|
|
|
2018-05-08 11:57:20 +00:00
|
|
|
- name: Install msmtp and s-nail on Archlinux.
|
2018-04-28 18:21:08 +00:00
|
|
|
pacman: name={{item}} state=present
|
|
|
|
with_items:
|
|
|
|
- msmtp
|
|
|
|
- msmtp-mta
|
2018-05-08 11:57:20 +00:00
|
|
|
- s-nail
|
2018-04-28 18:21:08 +00:00
|
|
|
when: ansible_os_family == "Archlinux"
|
|
|
|
|
|
|
|
- name: Copy mstprc conf file.
|
|
|
|
template:
|
|
|
|
src: msmtprc.j2
|
|
|
|
dest: /etc/msmtprc
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
tags: mail
|
|
|
|
notify: test mail
|
|
|
|
|
|
|
|
- name: Copy aliases conf file.
|
|
|
|
template:
|
|
|
|
src: aliases.j2
|
|
|
|
dest: /etc/aliases
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
tags: mail
|
|
|
|
notify: test mail
|