Initial commit
This commit is contained in:
14
roles/postfix/defaults/main.yml
Normal file
14
roles/postfix/defaults/main.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
38326433663334316231393964323861326634316138663137343462303639383539613232633865
|
||||
6462656338656163373330366635373431366638353365610a646133313831346534393736323737
|
||||
38616533373133383766303538643635326535303232633837653737616362323432313964653837
|
||||
6136306639613862340a316165623962356265646434383833303136656633656334343335633032
|
||||
33346234633833363936383937623835313130373133626231326361666566636161353361616361
|
||||
35323032383266643561636536616533333264613730623064663838346431353030393330336565
|
||||
31653864396466303338626535343063633139383731326430356436626530373766353033366237
|
||||
32343930373739306139643263306266333235383764656137326165646531646330383663306166
|
||||
31376366366465663862383834343233363163383839663263393637353762346333663136633563
|
||||
62393730363237666232353439623832623162363330616165653230653866663065613533393833
|
||||
62343261356164653835383866343139303136316235323530356136663730613234383563653562
|
||||
37346236366538366638633462326161333337316630333239643263303737663531373965386631
|
||||
3834
|
14
roles/postfix/files/aliases
Normal file
14
roles/postfix/files/aliases
Normal file
@@ -0,0 +1,14 @@
|
||||
postmaster: root
|
||||
nobody: root
|
||||
hostmaster: root
|
||||
usenet: root
|
||||
news: root
|
||||
webmaster: root
|
||||
www: root
|
||||
ftp: root
|
||||
abuse: root
|
||||
noc: root
|
||||
security: root
|
||||
root: jake
|
||||
jake: vm-mail@cyberinfo.se
|
||||
|
18
roles/postfix/handlers/main.yml
Normal file
18
roles/postfix/handlers/main.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
- name: Activate and restart Postfix
|
||||
service:
|
||||
name: postfix
|
||||
enabled: yes
|
||||
state: restarted
|
||||
|
||||
- name: Generate SASL
|
||||
command:
|
||||
cmd: /usr/sbin/postmap /etc/postfix/sasl_passwd
|
||||
|
||||
- name: Generate aliases
|
||||
command:
|
||||
cmd: /usr/sbin/postalias /etc/aliases
|
||||
|
||||
- name: Generate sender_canonical
|
||||
command:
|
||||
cmd: /usr/sbin/postmap /etc/postfix/sender_canonical
|
||||
|
34
roles/postfix/tasks/main.yml
Normal file
34
roles/postfix/tasks/main.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
- name: Install Postfix and s-nail
|
||||
package:
|
||||
state: present
|
||||
name: "{{ item }}"
|
||||
with_items:
|
||||
- postfix
|
||||
- s-nail
|
||||
notify: Activate and restart Postfix
|
||||
|
||||
- name: Configure Postfix
|
||||
template:
|
||||
src: main.cf.j2
|
||||
dest: /etc/postfix/main.cf
|
||||
notify: Activate and restart Postfix
|
||||
|
||||
- name: Copy Postfix authentication
|
||||
template:
|
||||
src: sasl_passwd.j2
|
||||
dest: /etc/postfix/sasl_passwd
|
||||
mode: 0600
|
||||
notify: Generate SASL
|
||||
|
||||
- name: Copy alisases
|
||||
copy:
|
||||
src: aliases
|
||||
dest: /etc/aliases
|
||||
notify: Generate aliases
|
||||
|
||||
- name: Copy sender_canonical
|
||||
template:
|
||||
src: sender_canonical.j2
|
||||
dest: /etc/postfix/sender_canonical
|
||||
notify: Generate sender_canonical
|
||||
|
29
roles/postfix/templates/main.cf.j2
Normal file
29
roles/postfix/templates/main.cf.j2
Normal file
@@ -0,0 +1,29 @@
|
||||
biff = no
|
||||
append_dot_mydomain = no
|
||||
compatibility_level = 2
|
||||
myhostname = {{ mail_hostname }}
|
||||
alias_maps = hash:/etc/aliases
|
||||
alias_database = hash:/etc/aliases
|
||||
myorigin = {{ mail_hostname }}
|
||||
mydestination = $myhostname, {{ mail_hostname }}, localhost
|
||||
relayhost = [{{ relay_host }}]:{{ relay_port }}
|
||||
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
|
||||
mailbox_size_limit = 0
|
||||
recipient_delimiter = +
|
||||
inet_interfaces = localhost
|
||||
inet_protocols = all
|
||||
|
||||
# enable SASL authentication
|
||||
smtp_sasl_auth_enable = yes
|
||||
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
|
||||
smtp_sasl_security_options = noanonymous
|
||||
smtp_sasl_tls_security_options = noanonymous
|
||||
|
||||
# Enable STARTTLS encryption
|
||||
smtp_use_tls = yes
|
||||
smtp_tls_wrappermode = yes
|
||||
smtp_tls_security_level = encrypt
|
||||
|
||||
# Setup sender canonical mapping
|
||||
sender_canonical_maps = hash:/etc/postfix/sender_canonical
|
||||
|
2
roles/postfix/templates/sasl_passwd.j2
Normal file
2
roles/postfix/templates/sasl_passwd.j2
Normal file
@@ -0,0 +1,2 @@
|
||||
[{{ relay_host }}]:{{ relay_port }} {{ relay_user }}:{{ relay_password }}
|
||||
|
3
roles/postfix/templates/sender_canonical.j2
Normal file
3
roles/postfix/templates/sender_canonical.j2
Normal file
@@ -0,0 +1,3 @@
|
||||
root root@{{ canonical_name }}
|
||||
jake jake@{{ canonical_name }}
|
||||
|
Reference in New Issue
Block a user