Skip to content

Instantly share code, notes, and snippets.

@greenhat
Created February 7, 2016 16:50
Show Gist options
  • Save greenhat/b74e26e61f672fd8f337 to your computer and use it in GitHub Desktop.
Save greenhat/b74e26e61f672fd8f337 to your computer and use it in GitHub Desktop.
Ansible playbook for setting up Postfix
---
- name: set debconf defaults before postfix install
shell: debconf-set-selections <<< "postfix postfix/mailname string {{ hostname }}" executable=/bin/bash
sudo: yes
tags: postfix
- name: set debconf defaults before postfix install
shell: debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" executable=/bin/bash
sudo: yes
tags: postfix
- name: install postfix
apt: pkg=postfix state=present
sudo: yes
tags: postfix
- name: forward all root mail to {{ email_forward }}
shell: echo "{{ email_forward }}" > /root/.forward
sudo: yes
notify: restart postfix
tags: postfix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment