2019-09-19 08:43:17 +00:00
|
|
|
- name: install postfix packages
|
|
|
|
apt:
|
|
|
|
name: postfix,postfix-pgsql,postfix-doc
|
|
|
|
state: present
|
|
|
|
update_cache: yes
|
|
|
|
install_recommends: no
|
|
|
|
|
|
|
|
- name: divert /etc/postfix/main.cf
|
|
|
|
shell: dpkg-divert --add --rename --divert /etc/postfix/main.cf.orig /etc/postfix/main.cf
|
|
|
|
|
|
|
|
- name: divert /etc/postfix/master.cf
|
|
|
|
shell: dpkg-divert --add --rename --divert /etc/postfix/master.cf.orig /etc/postfix/master.cf
|
|
|
|
|
|
|
|
- name: group 'mailstore'
|
|
|
|
group:
|
|
|
|
name: mailstore
|
|
|
|
state: present
|
|
|
|
system: yes
|
|
|
|
gid: 5000
|
|
|
|
|
|
|
|
- name: user 'mailstore'
|
|
|
|
user:
|
|
|
|
name: mailstore
|
|
|
|
group: mailstore
|
|
|
|
state: present
|
2020-09-17 08:25:27 +00:00
|
|
|
shell: /usr/sbin/nologin
|
2019-09-19 08:43:17 +00:00
|
|
|
system: yes
|
|
|
|
uid: 5000
|
|
|
|
create_home: no
|
|
|
|
home: /srv/mailstore
|
|
|
|
password: '!'
|
|
|
|
password_lock: yes
|
|
|
|
comment: created by ansible
|
|
|
|
|
|
|
|
- name: directories /srv/mailstore /srv/mailstore/role_specific
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: mailstore
|
|
|
|
group: mailstore
|
|
|
|
mode: 0755
|
|
|
|
loop:
|
|
|
|
- /srv/mailstore
|
|
|
|
- /srv/mailstore/role_specific
|
|
|
|
- /srv/mailstore/role_specific/roles
|
|
|
|
|
|
|
|
- name: postfix configuration files
|
|
|
|
template:
|
|
|
|
src: "postfix/{{ item }}"
|
|
|
|
dest: "/etc/postfix/{{ item }}"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
force: "{{ mailserver.postfix.overwrite_config }}"
|
|
|
|
loop:
|
|
|
|
- main.cf
|
|
|
|
- master.cf
|
|
|
|
- header_checks
|
|
|
|
|
|
|
|
- name: postfix database queries
|
|
|
|
template:
|
|
|
|
src: "postfix/{{ item }}"
|
|
|
|
dest: "/etc/postfix/{{ item }}"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0600
|
|
|
|
force: yes
|
|
|
|
loop:
|
|
|
|
- domains.cf
|
|
|
|
- mailboxes.cf
|
|
|
|
- aliases.cf
|
|
|
|
- email_existence_check.cf
|
|
|
|
- relay_domains.cf
|
|
|
|
- relay_recipient_maps.cf
|
|
|
|
- transport_maps.cf
|
2019-10-11 16:14:38 +00:00
|
|
|
- sender_canonical_maps.cf
|
|
|
|
- recipient_canonical_maps.cf
|
2019-09-19 08:43:17 +00:00
|
|
|
|
|
|
|
- name: restart postfix
|
|
|
|
systemd:
|
|
|
|
name: postfix
|
|
|
|
state: restarted
|