Created
April 6, 2015 11:41
-
-
Save remoteur/aa3d27a6fc948ed6e857 to your computer and use it in GitHub Desktop.
ansible-postfix-mandrill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: basenodes | |
tasks: | |
- name: Installs postfix mail server | |
apt: pkg=postfix state=installed update_cache=true | |
notify: | |
- start postfix | |
- name: Upload mandril authentication info | |
copy: src=/opt/files/postfix/mandril_passwd dest=/etc/postfix/mandril_passwd mode=0600 | |
register: mandril | |
notify: | |
- postmap mandril_passwd | |
- name: Append mandril relay config | |
lineinfile: | |
dest=/etc/postfix/main.cf | |
line="{{ item.line }}" | |
with_items: | |
- { line: 'smtp_sasl_auth_enable = yes' } | |
- { line: 'smtp_sasl_password_maps = hash:/etc/postfix/mandril_passwd' } | |
- { line: 'smtp_sasl_security_options = noanonymous' } | |
- { line: 'smtp_use_tls = yes' } | |
- { line: 'relayhost = [smtp.mandrillapp.com]' } | |
notify: | |
- restart postfix | |
handlers: | |
- name: start postfix | |
service: name=postfix state=started | |
- name: postmap mandril_passwd | |
command: postmap /etc/postfix/mandril_passwd | |
when: mandril|success | |
- name: restart postfix | |
service: name=postfix state=restarted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment