Rewriting playbook for multiserver purpose

This commit is contained in:
lucascbeyeler 2017-07-09 17:13:25 -03:00
parent 770ade33bd
commit d595f6bce7
7 changed files with 141 additions and 123 deletions

View File

@ -1,107 +0,0 @@
---
#
# Configuring SpamAssassin
################################################################################
- name: Downloading and Installing Kevin McGrail's Custom Rules
get_url:
url: https://www.pccc.com/downloads/SpamAssassin/contrib/KAM.cf
dest: /opt/zimbra/data/spamassassin/localrules/sakam.cf
mode: 0440
owner: zimbra
group: zimbra
- name: Configuring sauser.cf With new Scores
copy:
src: sauser.cf
dest: /opt/zimbra/data/spamassassin/localrules/sauser.cf
owner: root
group: root
mode: 0440
#
# Configuring Pyzor
################################################################################
- name: Downloading and Configuring Pyzor's Anti-spam Base
shell: pyzor --homedir /opt/zimbra/data/amavisd/.pyzor discover
become: true
become_user: zimbra
#
# Configuring Razor
################################################################################
- name: Creating Razor's Anti-spam Base
shell: razor-admin -home=/opt/zimbra/data/amavisd/.razor -create
become: true
become_user: zimbra
- name: Downloading Razor's Anti-spam Base
shell: razor-admin -home=/opt/zimbra/data/amavisd/.razor -discover
become: true
become_user: zimbra
- name: Registering your Razor installation
shell: 'razor-admin -home=/opt/zimbra/data/amavisd/.razor -register'
become: true
become_user: zimbra
#
# Configuring RBLs
################################################################################
- name: Importing zen.spamhaus.org RBL
shell: ./zmprov ms {{hostname}}.{{domain}} +zimbraMtaRestriction 'reject_rbl_client zen.spamhaus.org'
args:
chdir: /opt/zimbra/bin/
become: true
become_user: zimbra
- name: Importing sbl.spamhaus.org RBL
shell: ./zmprov ms {{hostname}}.{{domain}} +zimbraMtaRestriction 'reject_rbl_client sbl.spamhaus.org'
args:
chdir: /opt/zimbra/bin/
become: true
become_user: zimbra
- name: Importing dsn.rfc-ignorant.org RBL
shell: ./zmprov ms {{hostname}}.{{domain}} +zimbraMtaRestriction 'reject_rbl_client dsn.rfc-ignorant.org'
args:
chdir: /opt/zimbra/bin/
become: true
become_user: zimbra
- name: Importing bl.spamcop.net RBL
shell: ./zmprov ms {{hostname}}.{{domain}} +zimbraMtaRestriction 'reject_rbl_client bl.spamcop.net'
args:
chdir: /opt/zimbra/bin/
become: true
become_user: zimbra
- name: Importing dnsbl.sorbs.net RBL
shell: ./zmprov ms {{hostname}}.{{domain}} +zimbraMtaRestriction 'reject_rbl_client dnsbl.sorbs.net'
args:
chdir: /opt/zimbra/bin/
become: true
become_user: zimbra
#
# Configuring PolicyD
################################################################################
- name: Configuring PolicyD Database
copy:
src: 'config.php'
dest: /opt/zimbra/common/share/webui/includes/config.php
owner: root
group: root
mode: 0644
- name: Configuring PolicyD Web Interface
file:
src: /opt/zimbra/common/share/webui
dest: /opt/zimbra/data/httpd/htdocs/webui
state: link
- name: Enable PolicyD Web Interface
lineinfile:
dest: /opt/zimbra/conf/httpd.conf
regexp: "^ DirectoryIndex index.html index.html.var"
line: " DirectoryIndex index.html index.html.var index.php"
state: present

View File

@ -1,8 +0,0 @@
---
#
# Configuring Zimbra OSE
################################################################################
- name: Configuring Zimbra OSE's services for use
command: ./zmsetup.pl -c /tmp/zcs/installZimbraScript
args:
chdir: /opt/zimbra/libexec/

View File

@ -13,3 +13,46 @@
command: ./zmprov ms {{ hostname }}.{{ domain }} zimbraReverseProxyMailMode redirect
args:
chdir: /opt/zimbra/bin/
- name: Setting LMTP Host Lookup from DNS to Native
command: ./zmprov mcf zimbraMtaLmtpHostLookup native
args:
chdir: /opt/zimbra/bin/
#
# Configuring RBLs
################################################################################
- name: Importing zen.spamhaus.org RBL
shell: ./zmprov ms {{hostname}}.{{domain}} +zimbraMtaRestriction 'reject_rbl_client zen.spamhaus.org'
args:
chdir: /opt/zimbra/bin/
become: true
become_user: zimbra
- name: Importing sbl.spamhaus.org RBL
shell: ./zmprov ms {{hostname}}.{{domain}} +zimbraMtaRestriction 'reject_rbl_client sbl.spamhaus.org'
args:
chdir: /opt/zimbra/bin/
become: true
become_user: zimbra
- name: Importing dsn.rfc-ignorant.org RBL
shell: ./zmprov ms {{hostname}}.{{domain}} +zimbraMtaRestriction 'reject_rbl_client dsn.rfc-ignorant.org'
args:
chdir: /opt/zimbra/bin/
become: true
become_user: zimbra
- name: Importing bl.spamcop.net RBL
shell: ./zmprov ms {{hostname}}.{{domain}} +zimbraMtaRestriction 'reject_rbl_client bl.spamcop.net'
args:
chdir: /opt/zimbra/bin/
become: true
become_user: zimbra
- name: Importing dnsbl.sorbs.net RBL
shell: ./zmprov ms {{hostname}}.{{domain}} +zimbraMtaRestriction 'reject_rbl_client dnsbl.sorbs.net'
args:
chdir: /opt/zimbra/bin/
become: true
become_user: zimbra

View File

@ -1,8 +1,69 @@
---
#
# Configuring Zimbra OSE
# Configuring SpamAssassin
################################################################################
- name: Setting LMTP Host Lookup from DNS to Native
command: ./zmprov mcf zimbraMtaLmtpHostLookup native
args:
chdir: /opt/zimbra/bin/
- name: Downloading and Installing Kevin McGrail's Custom Rules
get_url:
url: https://www.pccc.com/downloads/SpamAssassin/contrib/KAM.cf
dest: /opt/zimbra/data/spamassassin/localrules/sakam.cf
mode: 0440
owner: zimbra
group: zimbra
- name: Configuring sauser.cf With new Scores
copy:
src: sauser.cf
dest: /opt/zimbra/data/spamassassin/localrules/sauser.cf
owner: root
group: root
mode: 0440
#
# Configuring Pyzor
################################################################################
- name: Downloading and Configuring Pyzor's Anti-spam Base
shell: pyzor --homedir /opt/zimbra/data/amavisd/.pyzor discover
become: true
become_user: zimbra
#
# Configuring Razor
################################################################################
- name: Creating Razor's Anti-spam Base
shell: razor-admin -home=/opt/zimbra/data/amavisd/.razor -create
become: true
become_user: zimbra
- name: Downloading Razor's Anti-spam Base
shell: razor-admin -home=/opt/zimbra/data/amavisd/.razor -discover
become: true
become_user: zimbra
- name: Registering your Razor installation
shell: 'razor-admin -home=/opt/zimbra/data/amavisd/.razor -register'
become: true
become_user: zimbra
#
# Configuring PolicyD
################################################################################
- name: Configuring PolicyD Database
copy:
src: 'config.php'
dest: /opt/zimbra/common/share/webui/includes/config.php
owner: root
group: root
mode: 0644
- name: Configuring PolicyD Web Interface
file:
src: /opt/zimbra/common/share/webui
dest: /opt/zimbra/data/httpd/htdocs/webui
state: link
- name: Enable PolicyD Web Interface
lineinfile:
dest: /opt/zimbra/conf/httpd.conf
regexp: "^ DirectoryIndex index.html index.html.var"
line: " DirectoryIndex index.html index.html.var index.php"
state: present

View File

@ -34,3 +34,8 @@
command: ./install.sh -s < /tmp/zcs/installZimbra-keystrokes
args:
chdir: '/usr/local/src/{{ zmpkg }}/'
- name: Configuring Zimbra OSE's services for use
command: ./zmsetup.pl -c /tmp/zcs/installZimbraScript
args:
chdir: /opt/zimbra/libexec/

View File

@ -1,19 +1,42 @@
---
#
# Main file
# Validations before run the playbook
################################################################################
- name: Checking if there is an Zimbra OSE install already
command: getent passwd zimbra
register: getent_passwd
- include: 'packages.yml'
#
# Installation process
################################################################################
- include: 'install/vars.yml'
when: getent_passwd.rc == 0
- include: 'install/dependencies.yml'
when: getent_passwd.rc == 0
- include: 'install/zimbra.yml'
when: getent_passwd.rc == 0
- include: 'install/policyd.yml'
when: getent_passwd.rc == 0 and zimbra-policyd == 'y'
- include: 'configure.yml'
#
# Configuration process
################################################################################
- include: 'configure/proxy.yml'
when: zimbra-proxy == 'y'
- include: 'configure/mailbox.yml'
when: zimbra-store == 'y'
- include: 'configure/mta.yml'
when: zimbra-mta == 'y'
#
# Extras configuration process
################################################################################
- include: 'extras/modify-logo.yml'
when: zmlogologin is defined and zmlogoapp is defined
#
# Restarting Zimbra
################################################################################
- name: 'Reloading Zimbra OSE Services'
command: zmcontrol restart
become: yes

View File

@ -14,6 +14,7 @@ zimbra-memcached: y
zimbra-proxy: y
zimbra-chat: n
zimbra-drive: n
zimbra-policyd: n
#
# Zimbra configuration