Skip to content

Instantly share code, notes, and snippets.

@gomasaba
Created August 19, 2015 12:07
Show Gist options
  • Save gomasaba/8c7a6d936d6ee4c7256f to your computer and use it in GitHub Desktop.
Save gomasaba/8c7a6d936d6ee4c7256f to your computer and use it in GitHub Desktop.
chachall postfix and RAINLOOP
- name: install packages
yum: name={{ item }}
with_items:
- postfix
- mail
- dovecot
- name: aliases.regexp
shell: echo "/(?!^root$|^catchall$)^.*$/ catchall" >> /etc/aliases.regexp creates=/etc/aliases.regexp
- name: transport_maps
shell: echo "/^.*@.*$/ local" >> /etc/postfix/transport_maps creates=/etc/postfix/transport_maps
- name: change main.cf
lineinfile: dest=/etc/postfix/main.cf regexp="{{ item.regexp }}" insertafter="{{item.insertafter}}" line="{{item.line}}" backup=yes
with_items:
- {
regexp: "^alias_maps",
insertafter: "#alias_maps",
line: "alias_maps = hash:/etc/aliases, pcre:/etc/aliases.regexp"
}
- {
regexp: "^transport_maps",
insertafter: "# See the discussion in the ADDRESS_REWRITING_README document.",
line: "transport_maps = pcre:/etc/postfix/transport_maps"
}
- name: create catchall user
user: name=catchall shell=/bin/false
- name: create INBOX directory
file: path=/home/catchall/mail/.imap/INBOX owner=catchall group=catchall mode=0755 state=directory
- name: change dovecot.conf
lineinfile: dest=/etc/dovecot/dovecot.conf regexp="{{ item.regexp }}" insertafter="{{item.insertafter}}" line="{{item.line}}" backup=yes
with_items:
- {
regexp: "^protocols",
insertafter: "#protocols",
line: "protocols = imap pop3"
}
- name: change 10-auth.conf
lineinfile: dest=/etc/dovecot/conf.d/10-auth.conf regexp="{{ item.regexp }}" insertafter="{{item.insertafter}}" line="{{item.line}}" backup=yes
with_items:
- {
regexp: "^disable_plaintext_auth",
insertafter: "#disable_plaintext_auth",
line: "disable_plaintext_auth = no"
}
- name: change 10-mail.conf
lineinfile: dest=/etc/dovecot/conf.d/10-mail.conf regexp="{{ item.regexp }}" insertafter="{{item.insertafter}}" line="{{item.line}}" backup=yes
with_items:
- {
regexp: "^mail_location",
insertafter: "#mail_location",
line: "mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u"
}
- name: download RAINLOOP
get_url: url=https://github.com/RainLoop/rainloop-webmail/archive/1.6.9.tar.gz dest=/tmp/rainloop-1.6.9.tar.gz
- name: unarchive RAINLOOP
unarchive: src=/tmp/rainloop-1.6.9.tar.gz dest=/var/www creates=/var/www/rainloop copy=no owner=vagrant group=vagrant mode=0755
- name: rename unarchive RAINLOOP
command: creates="/var/www/rainloop" mv /var/www/rainloop-webmail-1.6.9 /var/www/rainloop
- name: service postfix
service: name=postfix state=started enabled=true
- name: service dovecot
service: name=dovecot state=started enabled=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment