2021-07-01 18:52:55 +00:00
|
|
|
---
|
2023-03-03 19:58:41 +00:00
|
|
|
- name: Include tasks depending on OS
|
|
|
|
ansible.builtin.include_tasks:
|
|
|
|
file: "{{ item }}"
|
|
|
|
apply:
|
|
|
|
tags:
|
|
|
|
- wg-install
|
|
|
|
with_first_found:
|
|
|
|
- "setup-{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version }}.yml"
|
|
|
|
- "setup-{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}.yml"
|
|
|
|
- "setup-{{ ansible_distribution | lower }}-{{ ansible_distribution_release }}.yml"
|
|
|
|
- "setup-{{ ansible_distribution | lower }}.yml"
|
|
|
|
- "setup-{{ ansible_os_family | lower }}.yml"
|
|
|
|
|
2023-03-04 15:29:04 +00:00
|
|
|
- name: Ensure group "msmtp" exists
|
|
|
|
group:
|
|
|
|
name: msmtp
|
|
|
|
state: present
|
|
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
|
2021-07-01 18:52:55 +00:00
|
|
|
- name: Copy systemd unit file to server
|
|
|
|
copy:
|
|
|
|
src: msmtpd.service
|
2023-03-03 19:58:41 +00:00
|
|
|
dest: /usr/lib/systemd/system/msmtpd.service
|
|
|
|
mode: 0444
|
2021-07-01 18:52:55 +00:00
|
|
|
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
|
|
|
|
mode: 0444
|
|
|
|
notify:
|
|
|
|
- test mail
|
|
|
|
- restart msmtpd
|
|
|
|
when: ansible_os_family == "RedHat"
|
2021-07-12 19:40:55 +00:00
|
|
|
|
|
|
|
- name: enable daemon
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: msmtpd
|
|
|
|
enabled: yes
|
|
|
|
masked: no
|
|
|
|
daemon_reload: yes
|
|
|
|
when: ansible_os_family == "RedHat"
|