Commit 9dd903ab by Jesse Shapiro

Moving to new-style formatting for role; moving to explicit Postfix restart task

parent 7acc49f6
---
# postfix_queue: Configure a local postfix server to forward mail to an
# external SMTP server. This way postfix acts as an outgoing mail queue, and
# web apps can send mail instantly, while still taking advantage of an
# external SMTP service.
- name: restart postfix
service: name=postfix state=restarted
......@@ -25,50 +25,51 @@
- "smtp_tls_mandatory_ciphers = {{ postfix_queue_smtp_tls_mandatory_ciphers }}"
- "sender_canonical_maps = hash:{{ postfix_queue_sender_canonical_maps_file }}"
- "header_checks = regexp:{{ postfix_queue_header_checks_file }}"
notify: restart postfix
- name: Explain postfix authentication
lineinfile: >
dest="{{ postfix_queue_password_file }}"
line="# Configured by Ansible:"
create=yes
lineinfile:
dest: "{{ postfix_queue_password_file }}"
line: "# Configured by Ansible:"
create: yes
- name: Set permissions of password file
file: path="{{ postfix_queue_password_file }}" state=file mode="0600" owner=root group=root
- name: Configure postfix authentication
lineinfile: >
dest="{{ postfix_queue_password_file }}"
line="{{ postfix_queue_relayhost }} {{ POSTFIX_QUEUE_EXTERNAL_SMTP_USER }}:{{ POSTFIX_QUEUE_EXTERNAL_SMTP_PASSWORD }}"
insertafter="# Configured by Ansible:"
lineinfile:
dest: "{{ postfix_queue_password_file }}"
line: "{{ postfix_queue_relayhost }} {{ POSTFIX_QUEUE_EXTERNAL_SMTP_USER }}:{{ POSTFIX_QUEUE_EXTERNAL_SMTP_PASSWORD }}"
insertafter: "# Configured by Ansible:"
register: postfix_queue_password
- name: Hash postfix SASL password
command: "postmap hash:{{ postfix_queue_password_file }}"
when: postfix_queue_password.changed
notify: restart postfix
- name: Configure postfix sender canonical maps
copy: >
dest="{{ postfix_queue_sender_canonical_maps_file }}"
content="# Configured by Ansible:\n{{ POSTFIX_QUEUE_SENDER_CANONICAL_MAPS }}"
force=true
owner=root
group=root
mode="0600"
copy:
dest: "{{ postfix_queue_sender_canonical_maps_file }}"
content: "# Configured by Ansible:\n{{ POSTFIX_QUEUE_SENDER_CANONICAL_MAPS }}"
force: true
owner: root
group: root
mode: "0600"
register: postfix_queue_sender_canonical_maps
- name: Hash postfix sender canonical maps file
command: "postmap hash:{{ postfix_queue_sender_canonical_maps_file }}"
when: postfix_queue_sender_canonical_maps.changed
notify: restart postfix
- name: Configure postfix header checks
copy: >
dest="{{ postfix_queue_header_checks_file }}"
content="# Configured by Ansible:\n{{ POSTFIX_QUEUE_HEADER_CHECKS }}"
force=true
owner=root
group=root
mode="0600"
notify: restart postfix
copy:
dest: "{{ postfix_queue_header_checks_file }}"
content: "# Configured by Ansible:\n{{ POSTFIX_QUEUE_HEADER_CHECKS }}"
force: true
owner: root
group: root
mode: "0600"
- name: Restart Postfix
service:
name: postfix
state: restarted
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment