srv-stage/postfix.yml
2025-01-19 20:23:14 +01:00

66 lines
1.4 KiB
YAML

---
- name: verify if save file exist
stat:
path: /etc/postfix/main.cf.save
register: stat_result
- name: install postfix and module
yum:
name:
- postfix
- postfix-ldap
state: present
- name: save actual version
copy:
src: "{{ item }}"
dest: "{{ item }}.save"
#remote_src: yes
with_items:
- /etc/postfix/main.cf
- /etc/postfix/master.cf
when: stat_result.stat.exists == False
- name: configure postfix chroot
copy:
src: 'postfix/postfix_chroot'
dest: '/root/postfix_chroot'
owner: 'root'
group: 'root'
mode: '0744'
- name: configure postfix master.cf
copy:
src: 'postfix/master.cf'
dest: '/etc/postfix/master.cf'
- name: configure postfix main.cf
copy:
src: "postfix/{{ item }}"
dest: "/etc/postfix/{{ item }}"
with_items:
- main.cf
# - name: "{{ nPostfix }} - postmap transport"
# shell: postmap /etc/postfix/{{ item }}
# with_items:
# - transport
# changed_when: false
- name: execute postfix_chroot
shell: /root/postfix_chroot
changed_when: false
- name: add subject in header_checks
lineinfile:
path: /etc/postfix/header_checks
insertafter: EOF
line: "/^Subject:/ WARN"
- name: start & enable postfix
systemd_service:
name: postfix
state: started
enabled: yes