From 724d877995dfcc10c462a18dcb4ea6c8b60c2d03 Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sun, 2 Jul 2023 19:04:30 -0400 Subject: initial commit --- roles/postfix/tasks/main.yml | 84 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 roles/postfix/tasks/main.yml (limited to 'roles/postfix/tasks') diff --git a/roles/postfix/tasks/main.yml b/roles/postfix/tasks/main.yml new file mode 100644 index 0000000..0b482ea --- /dev/null +++ b/roles/postfix/tasks/main.yml @@ -0,0 +1,84 @@ +- name: install packages + package: + name: + - postfix + state: latest + +- name: deploy postfix main.cf + template: + src: main.cf.j2 + dest: /etc/postfix/main.cf + owner: root + group: root + mode: '0644' + +- name: deploy postfix master.cf + template: + src: master.cf.j2 + dest: /etc/postfix/master.cf + owner: root + group: root + mode: '0644' + +- name: create mailadmin user + user: + name: mailadmin + shell: /usr/sbin/nologin + password_lock: yes + +- name: deploy aliases file + template: + src: aliases + dest: /etc/aliases + owner: root + group: root + mode: '0644' + +- name: deploy login_maps + template: + src: login_maps + dest: /etc/postfix/login_maps + owner: root + group: root + mode: '0644' + +- name: deploy local_maps + template: + src: local_maps + dest: /etc/postfix/local_maps + owner: root + group: root + mode: '0644' + +- name: update address databases + shell: | + newaliases + postmap /etc/postfix/login_maps + postmap /etc/postfix/local_maps + +- name: deploy header checks file + copy: + src: header_checks + dest: /etc/postfix/header_checks + owner: root + group: root + mode: '0644' + +- name: deploy body checks file + copy: + src: body_checks + dest: /etc/postfix/body_checks + owner: root + group: root + mode: '0644' + +- name: enable postfix + systemd: + enabled: yes + masked: no + name: postfix + +- name: restart postfix + service: + name: postfix + state: restarted -- cgit v1.2.3