init Postfix roles
This commit is contained in:
parent
76fd99d283
commit
786f48e7f3
16
postfix/README.md
Normal file
16
postfix/README.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Postfix
|
||||||
|
|
||||||
|
Install Postfix
|
||||||
|
|
||||||
|
## Tasks
|
||||||
|
|
||||||
|
Minimal configuration is in `tasks/main.yml`.
|
||||||
|
|
||||||
|
## Available variables
|
||||||
|
|
||||||
|
Main variables are :
|
||||||
|
|
||||||
|
* `postfix_hostname` : hostname for Postfix ;
|
||||||
|
* `postfix_slow_transport` : enable customization for delivrability.
|
||||||
|
|
||||||
|
The full list of variables (with default values) can be found in `defaults/main.yml`.
|
3
postfix/defaults/main.yml
Normal file
3
postfix/defaults/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
postfix_hostname: "{{ ansible_fqdn }}"
|
||||||
|
postfix_slow: False
|
6
postfix/handlers/main.yml
Normal file
6
postfix/handlers/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- name: restart postfix
|
||||||
|
service:
|
||||||
|
name: postfix
|
||||||
|
state: restarted
|
||||||
|
|
28
postfix/tasks/main.yml
Normal file
28
postfix/tasks/main.yml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
- name: ensure packages are installed
|
||||||
|
apt:
|
||||||
|
name: '{{ item }}'
|
||||||
|
state: present
|
||||||
|
with_items:
|
||||||
|
- postfix
|
||||||
|
- mailgraph
|
||||||
|
|
||||||
|
- name: check if main.cf is default
|
||||||
|
shell: egrep -v "^(myhostname|mydestination|mailbox_command)" /etc/postfix/main.cf | md5sum -
|
||||||
|
changed_when: False
|
||||||
|
#check_mode: no (for migration to Ansible 2.2)
|
||||||
|
always_run: yes
|
||||||
|
register: default_main_cf
|
||||||
|
|
||||||
|
- name: create minimal main.cf
|
||||||
|
template:
|
||||||
|
src: evolinux_main.cf.j2
|
||||||
|
dest: /etc/postfix/main.cf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
force: yes
|
||||||
|
when: default_main_cf.stdout == "5450c05d65878e99dad696c7c722e511 -"
|
||||||
|
notify: restart postfix
|
||||||
|
|
||||||
|
- meta: flush_handlers
|
||||||
|
|
15
postfix/templates/evolinux_main.cf.j2
Normal file
15
postfix/templates/evolinux_main.cf.j2
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
smtpd_banner = $myhostname ESMTP mail server
|
||||||
|
biff = no
|
||||||
|
append_dot_mydomain = no
|
||||||
|
myhostname = {{ postfix_hostname }}
|
||||||
|
alias_maps = hash:/etc/aliases
|
||||||
|
alias_database = hash:/etc/aliases
|
||||||
|
myorigin = $myhostname
|
||||||
|
mydestination = $myhostname localhost.localdomain localhost
|
||||||
|
relayhost =
|
||||||
|
mynetworks = 127.0.0.0/8
|
||||||
|
mailbox_size_limit = 0
|
||||||
|
recipient_delimiter = +
|
||||||
|
inet_interfaces = all
|
||||||
|
inet_protocols = ipv4
|
||||||
|
disable_vrfy_command = yes
|
Loading…
Reference in a new issue