71 lines
1.5 KiB
YAML
71 lines
1.5 KiB
YAML
- name: Configure mailname
|
|
template:
|
|
src: ./filesystem/common/etc/mailname.j2
|
|
dest: /etc/mailname
|
|
mode: 0644
|
|
register: mail_mailname
|
|
|
|
- name: Configure mailutils
|
|
template:
|
|
src: ./filesystem/common/etc/mailutils.conf.j2
|
|
dest: /etc/mailutils.conf
|
|
mode: 0644
|
|
|
|
- name: Install postfix
|
|
apt:
|
|
name:
|
|
- postfix
|
|
- ca-certificates
|
|
- libsasl2-modules
|
|
|
|
- name: Configure aliases
|
|
template:
|
|
src: ./filesystem/common/etc/aliases.j2
|
|
dest: /etc/aliases
|
|
mode: 0644
|
|
register: mail_aliases
|
|
|
|
- name: Update aliases
|
|
command: newaliases
|
|
when: mail_aliases is changed
|
|
|
|
- name: Configure postfix
|
|
template:
|
|
src: ./filesystem/common/etc/postfix/main.cf.j2
|
|
dest: /etc/postfix/main.cf
|
|
mode: 0644
|
|
register: mail_postfix_conf
|
|
|
|
- name: Configure credentials
|
|
template:
|
|
src: ./filesystem/common/etc/postfix/sasl_passwd.j2
|
|
dest: /etc/postfix/sasl_passwd
|
|
mode: 0600
|
|
register: mail_postfix_credentials
|
|
|
|
- name: Create hash database
|
|
command: postmap /etc/postfix/sasl_passwd
|
|
when:
|
|
mail_postfix_credentials is changed
|
|
|
|
- name: Set hash database permissions
|
|
file:
|
|
path: /etc/postfix/sasl_passwd.db
|
|
mode: 0600
|
|
|
|
- name: Enable/start postfix
|
|
systemd:
|
|
name: postfix
|
|
enabled: yes
|
|
state: started
|
|
|
|
- name: Restart postfix
|
|
systemd:
|
|
name: postfix
|
|
state: restarted
|
|
when:
|
|
mail_mailname is changed or
|
|
mail_aliases is changed or
|
|
mail_postfix_conf is changed or
|
|
mail_postfix_credentials is changed
|