2014-03-21 19:16:55 +00:00
|
|
|
---
|
2018-04-28 18:21:08 +00:00
|
|
|
# Deploy msmtp
|
2019-07-30 17:27:46 +00:00
|
|
|
|
|
|
|
# TODO:
|
2019-07-31 14:51:00 +00:00
|
|
|
# Fix: Check if mailserver is ready, as Test mail will only work,
|
|
|
|
# if msmtp is setup after the mailserver is already configured
|
2019-07-30 17:27:46 +00:00
|
|
|
|
2021-05-15 15:20:39 +00:00
|
|
|
- name: Copy RPM file to server
|
|
|
|
copy:
|
|
|
|
src: msmtp-1.8.14-1.el8.x86_64.rpm
|
|
|
|
dest: /tmp/msmtp-1.8.14-1.el8.x86_64.rpm
|
|
|
|
when: ansible_os_family == "RedHat"
|
2014-03-21 19:16:55 +00:00
|
|
|
|
2021-05-15 15:20:39 +00:00
|
|
|
- name: Copy systemd unit file to server
|
|
|
|
copy:
|
|
|
|
src: msmtpd.service
|
|
|
|
dest: /etc/systemd/system/msmtpd.service
|
|
|
|
when: ansible_os_family == "RedHat"
|
2018-04-28 18:21:08 +00:00
|
|
|
|
2021-05-15 15:20:39 +00:00
|
|
|
- name: enable daemon
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: msmtpd
|
|
|
|
enabled: yes
|
|
|
|
masked: no
|
|
|
|
daemon_reload: yes
|
|
|
|
when: ansible_os_family == "RedHat"
|
2018-04-28 18:21:08 +00:00
|
|
|
|
2021-05-15 15:20:39 +00:00
|
|
|
- name: Install msmtp
|
|
|
|
yum:
|
|
|
|
name:
|
|
|
|
- /tmp/msmtp-1.8.14-1.el8.x86_64.rpm
|
|
|
|
- mailx
|
2019-07-31 14:51:00 +00:00
|
|
|
state: present
|
2021-05-15 15:20:39 +00:00
|
|
|
disable_gpg_check: yes
|
|
|
|
when: ansible_os_family == "RedHat"
|
2018-04-28 18:21:08 +00:00
|
|
|
|
2021-05-15 15:20:39 +00:00
|
|
|
- name: Ensure group "msmtp" exists
|
|
|
|
group:
|
|
|
|
name: msmtp
|
2018-05-26 14:12:37 +00:00
|
|
|
state: present
|
2021-05-15 15:20:39 +00:00
|
|
|
when: ansible_os_family == "RedHat"
|
2018-05-26 14:12:37 +00:00
|
|
|
|
2018-04-28 18:21:08 +00:00
|
|
|
- name: Copy mstprc conf file.
|
|
|
|
template:
|
|
|
|
src: msmtprc.j2
|
|
|
|
dest: /etc/msmtprc
|
|
|
|
owner: root
|
2021-05-15 15:20:39 +00:00
|
|
|
group: msmtp
|
|
|
|
mode: 0640
|
2018-04-28 18:21:08 +00:00
|
|
|
tags: mail
|
2021-05-15 15:20:39 +00:00
|
|
|
notify:
|
|
|
|
- test mail
|
|
|
|
- restart msmtpd
|
2018-04-28 18:21:08 +00:00
|
|
|
|
|
|
|
- name: Copy aliases conf file.
|
|
|
|
template:
|
2021-05-15 15:20:39 +00:00
|
|
|
src: aliases-rhel.j2
|
2018-04-28 18:21:08 +00:00
|
|
|
dest: /etc/aliases
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
tags: mail
|
2021-05-15 15:20:39 +00:00
|
|
|
notify:
|
|
|
|
- test mail
|
|
|
|
- restart msmtpd
|
|
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
|
|
|
|
- name: Copy sysconfig file.
|
|
|
|
template:
|
|
|
|
src: sysconfig.j2
|
|
|
|
dest: /etc/sysconfig/msmtpd
|
|
|
|
notify:
|
|
|
|
- test mail
|
|
|
|
- restart msmtpd
|
|
|
|
when: ansible_os_family == "RedHat"
|