Skip to content

Commit

Permalink
Copy /etc files all together
Browse files Browse the repository at this point in the history
  • Loading branch information
amedee committed Aug 7, 2024
1 parent 27e420d commit 0e54fc6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 29 deletions.
2 changes: 2 additions & 0 deletions roles/mailserver/files/etc/postfix/sasl/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# DO NOT EDIT OR REMOVE
# This file is a simple placeholder to keep git from removing this directory
34 changes: 9 additions & 25 deletions roles/mailserver/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
state: present
pkg: "{{ mailserver_apt_packages }}"

- name: Create directories if they don't exist
- name: Copy etc files
become: true
ansible.builtin.file:
path: "{{ item }}"
state: directory
ansible.builtin.copy:
src: etc/
dest: /etc/
owner: root
mode: u=rwx,go=rx
loop: "{{ mailserver_postfix_directories }}"
mode: u=rw,go=r
directory_mode: u=rwx,go=rx
notify:
- Restart Postfix
- Restart Rsyslog

- name: Create /etc/postfix/sasl/sasl_passwd from template
become: true
Expand All @@ -23,16 +26,6 @@
mode: u=rw,go=
notify: Update Postfix hashtables

- name: Copy checks files
become: true
ansible.builtin.copy:
src: "{{ item }}"
dest: /etc/postfix/checks/
owner: root
mode: u=rw,go=r
with_fileglob: "etc/postfix/checks/*_checks.pcre"
notify: Update Postfix hashtables

- name: Configure Postfix
become: true
ansible.builtin.lineinfile:
Expand All @@ -44,12 +37,3 @@
line: "{{ item.line }}"
loop: "{{ mailserver_postfix_settings }}"
notify: Restart Postfix

- name: Configure logrotate for Postfix
become: true
ansible.builtin.copy:
src: etc/logrotate.d/postfix
dest: /etc/logrotate.d/postfix
owner: root
mode: u=rw,go=r
notify: Restart Rsyslog
4 changes: 0 additions & 4 deletions roles/mailserver/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ mailserver_apt_packages:
- postfix
- postfix-pcre

mailserver_postfix_directories:
- /etc/postfix/checks
- /etc/postfix/sasl

mailserver_postfix_settings:
- { regexp: '^body_checks', line: 'body_checks = pcre:/etc/postfix/checks/body_checks.pcre'}
- { regexp: '^header_checks', line: 'header_checks = pcre:/etc/postfix/checks/header_checks.pcre'}
Expand Down

0 comments on commit 0e54fc6

Please sign in to comment.