Skip to content

Instantly share code, notes, and snippets.

@runar
Created May 12, 2015 15:38
Show Gist options
  • Select an option

  • Save runar/fbfe0d5a2c10efe40bb5 to your computer and use it in GitHub Desktop.

Select an option

Save runar/fbfe0d5a2c10efe40bb5 to your computer and use it in GitHub Desktop.
---
- name: Set debconf values
debconf: name=postfix question={{ item.question }} value="{{ item.value }}" vtype={{ item.vtype }}
with_items:
- { question: 'postfix/main_mailer_type', value: "Internet Site", vtype: 'select' }
- { question: 'postfix/mailname' , value: "{{ ansible_fqdn }}", vtype: 'string' }
- name: Install postfix and mailutils
apt: pkg={{ item }} update_cache=yes cache_valid_time=86400
with_items:
- postfix
- mailutils
- name: Listen on local interface only
lineinfile: dest=/etc/postfix/main.cf regexp='^inet_interfaces' line='inet_interfaces = 127.0.0.1'
notify: restart postfix
- name: Add root email alias to aliases
lineinfile: "dest=/etc/aliases line='root: my@email'"
notify: reload aliases
- name: Send test email
local_action: mail
host="127.0.0.1"
subject="System {{ ansible_hostname }} has been successfully provisioned."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment