WIP: conversion a docker

This commit is contained in:
Mauro Torrez
2019-09-07 19:27:12 -03:00
parent 0187fe290c
commit cc7260fea3
6 changed files with 131 additions and 135 deletions

View File

@@ -1,32 +1,36 @@
---
- name: restart postfix
service: name=postfix state=restarted
docker_container:
name: "{{ postfix_container}}"
state: started
restart: yes
- name: reload postfix
service: name=postfix state=restarted
command: docker exec {{ postfix_container }} postfix reload
- name: newaliases
command: newaliases
command: docker exec {{ postfix_container }} newaliases
- name: postmap hash aliases
command: "postmap hash:{{ dc[item]['alias_lookup']['file'] }}"
command: "docker exec {{ postfix_container }} postmap hash:{{ postfix_mail_domains[item].alias_lookup.file }}"
when:
- "dc[item]['alias_lookup']['provider'] == 'file'"
with_items: "{{ postfix_mail_domains|belist }}"
- postfix_mail_domains[item].alias_lookup.provider|default(postfix_lookup_provider) == 'file'
loop: "{{ postfix_mail_domains.keys()|list }}"
- name: postmap hash users
command: "postmap hash:{{ dc[item]['user_lookup']['file'] }}"
command: "docker exec {{ postfix_container }} postmap hash:{{ postfix_mail_domains[item].user_lookup.file }}"
when:
- "dc[item]['user_lookup']['provider'] == 'file'"
with_items: "{{ postfix_mail_domains|belist }}"
- postfix_mail_domains[item].user_lookup.provider|default(postfix_lookup_provider) == 'file'
loop: "{{ postfix_mail_domains.keys()|list }}"
- name: postmap no reply aliases
command: "postmap hash:{{ dc[item]['noreply_file'] }}"
with_items: "{{ postfix_mail_domains|belist }}"
command: "docker exec {{ postfix_container }} postmap hash:{{ postfix_mail_domains[item].noreply_file }}"
loop: "{{ postfix_mail_domains.keys()|list }}"
- name: postmap access lists
command: postmap {{item}}
with_items:
- "{{ postfix_rules_dir }}/helo_access_list"
- "{{ postfix_rules_dir }}/recipient_access_list"
- "{{ postfix_rules_dir }}/sender_access_list"
command: docker exec {{ postfix_container }} postmap {{ item }}
loop:
- "/etc/postfix/{{ postfix_rules_dir }}/client_access_list"
- "/etc/postfix/{{ postfix_rules_dir }}/helo_access_list"
- "/etc/postfix/{{ postfix_rules_dir }}/recipient_access_list"
- "/etc/postfix/{{ postfix_rules_dir }}/sender_access_list"