--- # Deploy msmtp # TODO: # Fix: Check if mailserver is ready, as Test mail will only work, # if msmtp is setup after the mailserver is already configured - 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" - name: Copy systemd unit file to server copy: src: msmtpd.service dest: /etc/systemd/system/msmtpd.service when: ansible_os_family == "RedHat" - name: enable daemon ansible.builtin.systemd: name: msmtpd enabled: yes masked: no daemon_reload: yes when: ansible_os_family == "RedHat" - name: Install msmtp yum: name: - /tmp/msmtp-1.8.14-1.el8.x86_64.rpm - mailx state: present disable_gpg_check: yes when: ansible_os_family == "RedHat" - name: Ensure group "msmtp" exists group: name: msmtp state: present when: ansible_os_family == "RedHat" - name: Copy mstprc conf file. template: src: msmtprc.j2 dest: /etc/msmtprc owner: root group: msmtp mode: 0640 tags: mail notify: - test mail - restart msmtpd - name: Copy aliases conf file. template: src: aliases-rhel.j2 dest: /etc/aliases owner: root group: root mode: 0644 tags: mail 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"