added tests with ubuntu 14.04
This commit is contained in:
parent
15379d2f4a
commit
7d058d7dbb
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2016 Paul Lecuq
|
Copyright (c) 2014 Alexandros Giouzenis
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
96
README.md
Normal file
96
README.md
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
Ansible Zimbra
|
||||||
|
=========
|
||||||
|
|
||||||
|
Install, configure and provision a Full Zimbra Server.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
* CentOS 6, 7
|
||||||
|
* RHEL 6, 7
|
||||||
|
* Ubuntu 14.04
|
||||||
|
* Correctly configure DNS
|
||||||
|
* Correctly configued `/etc/hosts` file : now auto-configured by this ansible role
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* `zimbra_download_url`, URL to download Zimbra
|
||||||
|
* `zimbra_file`, name of the downloaded file
|
||||||
|
* `zimbra_256sum_file`, `SHA256SUM` of the file
|
||||||
|
* `zimbra_password`, password for admin and everything
|
||||||
|
* `zimbra_default_domain`, default domain to create
|
||||||
|
|
||||||
|
**zimbra_domains**
|
||||||
|
|
||||||
|
* `name`, name of a domain
|
||||||
|
* `accounts`, Array of accounts
|
||||||
|
* `distribution_lists`, Array of Distribution Lists
|
||||||
|
|
||||||
|
**accounts**
|
||||||
|
|
||||||
|
* `name`, email of the account
|
||||||
|
* `password`, if empty the default pass is `12345678`
|
||||||
|
|
||||||
|
**distribution_lists**
|
||||||
|
|
||||||
|
* `name`, email of the Distribution List
|
||||||
|
* `members`, Array of email addresses of members
|
||||||
|
* `authorized_senders`, Array of domain accounts who can send email to the list
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
sudo: yes
|
||||||
|
vars:
|
||||||
|
zimbra_download_url: https://files.zimbra.com/downloads/8.6.0_GA/zcs-8.6.0_GA_1153.RHEL6_64.20141215151155.tgz
|
||||||
|
zimbra_file: zcs-8.6.0_GA_1153.RHEL6_64.20141215151155
|
||||||
|
zimbra_256sum_file: c2278e6632b9ca72487afdf24da2545238e325338090a9d8ad6e99b39593561c
|
||||||
|
zimbra_password: Passw0rd
|
||||||
|
zimbra_default_domain: 'mydom.com'
|
||||||
|
|
||||||
|
zimbra_domains:
|
||||||
|
- name: 'mydom.com'
|
||||||
|
o: 'My Dom'
|
||||||
|
accounts:
|
||||||
|
- name: 'paul@mydom.com'
|
||||||
|
zimbra_is_admin_account: TRUE
|
||||||
|
password: Passw0rd
|
||||||
|
|
||||||
|
- name: 'mydom2.com'
|
||||||
|
o: 'My dom 2'
|
||||||
|
|
||||||
|
- name: 'mydom3.com'
|
||||||
|
o: 'My dom 3'
|
||||||
|
accounts:
|
||||||
|
- name: 'admin@mydom3.com'
|
||||||
|
password: Passw0rd
|
||||||
|
zimbra_is_domain_admin_account: TRUE
|
||||||
|
|
||||||
|
distribution_lists:
|
||||||
|
- name: 'user@mydom3.com'
|
||||||
|
members:
|
||||||
|
- '1@mydom4.com'
|
||||||
|
- '2@mydom3.com'
|
||||||
|
authorized_senders:
|
||||||
|
- 'paul@mydom.com'
|
||||||
|
|
||||||
|
- name: 'empty.com'
|
||||||
|
o: 'My dom 4'
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: zimbra
|
||||||
|
```
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
MIT
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Based on ansible-zimbradev by pbruna
|
2
defaults/main.yml
Normal file
2
defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for cartertdte.mta
|
5
handlers/main.yml
Normal file
5
handlers/main.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
# handlers file for cartertdte.mta
|
||||||
|
|
||||||
|
- name: postfix restart
|
||||||
|
service: name=postfix state=restarted
|
128
meta/main.yml
Normal file
128
meta/main.yml
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description:
|
||||||
|
company: your company (optional)
|
||||||
|
# Some suggested licenses:
|
||||||
|
# - BSD (default)
|
||||||
|
# - MIT
|
||||||
|
# - GPLv2
|
||||||
|
# - GPLv3
|
||||||
|
# - Apache
|
||||||
|
# - CC-BY
|
||||||
|
license: license (GPLv2, CC-BY, etc)
|
||||||
|
min_ansible_version: 1.2
|
||||||
|
#
|
||||||
|
# Below are all platforms currently available. Just uncomment
|
||||||
|
# the ones that apply to your role. If you don't see your
|
||||||
|
# platform on this list, let us know and we'll get it added!
|
||||||
|
#
|
||||||
|
#platforms:
|
||||||
|
#- name: EL
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 5
|
||||||
|
# - 6
|
||||||
|
# - 7
|
||||||
|
#- name: GenericUNIX
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 16
|
||||||
|
# - 17
|
||||||
|
# - 18
|
||||||
|
# - 19
|
||||||
|
# - 20
|
||||||
|
#- name: SmartOS
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: opensuse
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 12.1
|
||||||
|
# - 12.2
|
||||||
|
# - 12.3
|
||||||
|
# - 13.1
|
||||||
|
# - 13.2
|
||||||
|
#- name: Amazon
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 2013.03
|
||||||
|
# - 2013.09
|
||||||
|
#- name: GenericBSD
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: FreeBSD
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 8.0
|
||||||
|
# - 8.1
|
||||||
|
# - 8.2
|
||||||
|
# - 8.3
|
||||||
|
# - 8.4
|
||||||
|
# - 9.0
|
||||||
|
# - 9.1
|
||||||
|
# - 9.1
|
||||||
|
# - 9.2
|
||||||
|
#- name: Ubuntu
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - lucid
|
||||||
|
# - maverick
|
||||||
|
# - natty
|
||||||
|
# - oneiric
|
||||||
|
# - precise
|
||||||
|
# - quantal
|
||||||
|
# - raring
|
||||||
|
# - saucy
|
||||||
|
# - trusty
|
||||||
|
#- name: SLES
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 10SP3
|
||||||
|
# - 10SP4
|
||||||
|
# - 11
|
||||||
|
# - 11SP1
|
||||||
|
# - 11SP2
|
||||||
|
# - 11SP3
|
||||||
|
#- name: GenericLinux
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: Debian
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - etch
|
||||||
|
# - lenny
|
||||||
|
# - squeeze
|
||||||
|
# - wheezy
|
||||||
|
#
|
||||||
|
# Below are all categories currently available. Just as with
|
||||||
|
# the platforms above, uncomment those that apply to your role.
|
||||||
|
#
|
||||||
|
#categories:
|
||||||
|
#- cloud
|
||||||
|
#- cloud:ec2
|
||||||
|
#- cloud:gce
|
||||||
|
#- cloud:rax
|
||||||
|
#- clustering
|
||||||
|
#- database
|
||||||
|
#- database:nosql
|
||||||
|
#- database:sql
|
||||||
|
#- development
|
||||||
|
#- monitoring
|
||||||
|
#- networking
|
||||||
|
#- packaging
|
||||||
|
#- system
|
||||||
|
#- web
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line. Only
|
||||||
|
# dependencies available via galaxy should be listed here.
|
||||||
|
# Be sure to remove the '[]' above if you add dependencies
|
||||||
|
# to this list.
|
||||||
|
|
7
tasks/CentOS.yml
Normal file
7
tasks/CentOS.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
# test
|
||||||
|
|
||||||
|
- name: Install Zimbra Dependencies
|
||||||
|
yum: name={{ item }} state=present
|
||||||
|
with_items:
|
||||||
|
- "{{ zimbra_required_packages }}"
|
6
tasks/Ubuntu.yml
Normal file
6
tasks/Ubuntu.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
# Install zimbra dependencies
|
||||||
|
|
||||||
|
- name: Install Zimbra Dependencies
|
||||||
|
apt: name={{ item }} state=present
|
||||||
|
with_items: zimbra_required_packages
|
13
tasks/configure_zimbra.yml
Normal file
13
tasks/configure_zimbra.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# roles/bind/tasks/confgiure_zimbra.yml
|
||||||
|
# Configuration of Zimbra
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Copy configuration file
|
||||||
|
template:
|
||||||
|
src: zimbra_configuration.conf.j2
|
||||||
|
dest: /tmp/zimbra_configuration.conf
|
||||||
|
owner: zimbra
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Run Zimbra zmsetup.pl
|
||||||
|
command: /opt/zimbra/libexec/zmsetup.pl -c /tmp/zimbra_configuration.conf
|
15
tasks/install_zimbra.yml
Normal file
15
tasks/install_zimbra.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# roles/bind/tasks/install_zimbra.yml
|
||||||
|
# Install Zimbra Software
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Untar Zimbra src
|
||||||
|
unarchive: src=/opt/src/{{ zimbra_file }}.tgz dest=/tmp/ copy=no
|
||||||
|
|
||||||
|
- name: Install Zimbra Software
|
||||||
|
shell: yes 'Y' | /tmp/{{ zimbra_file }}/install.sh -s --platform-override -x
|
||||||
|
args:
|
||||||
|
chdir: /tmp/{{ zimbra_file }}/
|
||||||
|
creates: /opt/zimbra/bin/zmprov
|
||||||
|
|
||||||
|
- name: Remove Zimbra src
|
||||||
|
file: path=/tmp/{{ zimbra_file }} state=absent
|
60
tasks/main.yml
Normal file
60
tasks/main.yml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
# tasks file for cartertdte.mta
|
||||||
|
|
||||||
|
- name: Include distribution specific variables
|
||||||
|
include_vars: "{{ ansible_distribution }}.yml"
|
||||||
|
tags: zimbra
|
||||||
|
|
||||||
|
- include: CentOS.yml
|
||||||
|
when: ansible_distribution == "CentOS"
|
||||||
|
tags: zimbra
|
||||||
|
|
||||||
|
- include: Ubuntu.yml
|
||||||
|
when: ansible_distribution == "Ubuntu"
|
||||||
|
tags: zimbra
|
||||||
|
|
||||||
|
- name: Set hostname
|
||||||
|
command: hostname {{ zimbra_hostname }}
|
||||||
|
|
||||||
|
- name: Set hosts file
|
||||||
|
template:
|
||||||
|
src=hosts.j2
|
||||||
|
dest=/etc/hosts
|
||||||
|
owner=root
|
||||||
|
mode=0644
|
||||||
|
|
||||||
|
- name: Disable and stop dnsmasq service
|
||||||
|
service:
|
||||||
|
name=dnsmasq
|
||||||
|
state=stopped
|
||||||
|
enabled=no
|
||||||
|
|
||||||
|
- name: Create Source Software Directory
|
||||||
|
file: path=/opt/src state=directory
|
||||||
|
|
||||||
|
- name: 'Download Zimbra .tgz file'
|
||||||
|
get_url:
|
||||||
|
url={{ zimbra_download_url }}
|
||||||
|
dest=/opt/src/{{ zimbra_file }}.tgz
|
||||||
|
timeout=60
|
||||||
|
sha256sum={{ zimbra_256sum_file }}
|
||||||
|
|
||||||
|
- name: Check if Zimbra is installed
|
||||||
|
stat: path=/opt/zimbra/bin/zmprov
|
||||||
|
register: zimbra_check_installation
|
||||||
|
|
||||||
|
- include: install_zimbra.yml
|
||||||
|
when: zimbra_check_installation.stat.islnk is not defined
|
||||||
|
|
||||||
|
- name: Check if Zimbra is configured
|
||||||
|
command: /opt/zimbra/bin/zmprov gd {{ zimbra_default_domain }}
|
||||||
|
ignore_errors: yes
|
||||||
|
register: zimbra_check_configuration
|
||||||
|
|
||||||
|
- include: configure_zimbra.yml
|
||||||
|
when: zimbra_check_configuration.rc != 0
|
||||||
|
|
||||||
|
- name: Start zimbra
|
||||||
|
service: name=zimbra state=restarted
|
||||||
|
|
||||||
|
- include: provision_zimbra.yml
|
17
tasks/provision_zimbra.yml
Normal file
17
tasks/provision_zimbra.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# roles/bind/tasks/provision_zimbra.yml
|
||||||
|
# Provision Zimbra with users and etc.
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Copy provisioning file
|
||||||
|
template:
|
||||||
|
src: zimbra_provisioning.j2
|
||||||
|
dest: /tmp/zimbra_provisioning
|
||||||
|
owner: zimbra
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Provision Zimbra
|
||||||
|
sudo_user: zimbra
|
||||||
|
shell: /opt/zimbra/bin/zmprov < /tmp/zimbra_provisioning
|
||||||
|
|
||||||
|
- name: Delete provisioning file
|
||||||
|
file: path=/tmp/zimbra_provisioning state=absent
|
7
templates/hosts.j2
Normal file
7
templates/hosts.j2
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# The following lines are desirable for IPv6 capable hosts
|
||||||
|
::1 localhost ip6-localhost ip6-loopback
|
||||||
|
ff02::1 ip6-allnodes
|
||||||
|
ff02::2 ip6-allrouters
|
||||||
|
127.0.0.1 localhost
|
||||||
|
{{ ansible_eth0.ipv4.address }} {{ zimbra_hostname }}.{{ zimbra_default_domain }} {{ zimbra_hostname }}
|
||||||
|
|
2
templates/resolv.conf.j2
Normal file
2
templates/resolv.conf.j2
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
search localdomain ffx.net
|
||||||
|
nameserver 127.0.0.1
|
23
templates/zimbra_configuration.conf.j2
Normal file
23
templates/zimbra_configuration.conf.j2
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
CREATEADMINPASS="{{ zimbra_password }}"
|
||||||
|
LDAPAMAVISPASS="{{ zimbra_password }}"
|
||||||
|
LDAPPOSTPASS="{{ zimbra_password }}"
|
||||||
|
LDAPROOTPASS="{{ zimbra_password }}"
|
||||||
|
LDAPADMINPASS="{{ zimbra_password }}"
|
||||||
|
LDAPREPPASS="{{ zimbra_password }}"
|
||||||
|
LDAPBESSEARCHSET="set"
|
||||||
|
LDAPHOST="{{ zimbra_hostname }}"
|
||||||
|
LDAPPORT="389"
|
||||||
|
LDAPREPLICATIONTYPE="master"
|
||||||
|
LDAPSERVERID="2"
|
||||||
|
ldap_nginx_password="{{ zimbra_password }}"
|
||||||
|
ldap_bes_searcher_password="{{ zimbra_password }}"
|
||||||
|
AVDOMAIN="{{ zimbra_default_domain }}"
|
||||||
|
AVUSER="admin@{{ zimbra_default_domain }}"
|
||||||
|
CREATEADMIN="admin@{{ zimbra_default_domain }}"
|
||||||
|
CREATEDOMAIN="{{ zimbra_default_domain }}"
|
||||||
|
DOCREATEADMIN="yes"
|
||||||
|
DOCREATEDOMAIN="yes"
|
||||||
|
EXPANDMENU="no"
|
||||||
|
HOSTNAME="{{ zimbra_hostname }}"
|
||||||
|
DOTRAINSA="yes"
|
||||||
|
ENABLEGALSYNCACCOUNTS=""
|
25
templates/zimbra_provisioning.j2
Normal file
25
templates/zimbra_provisioning.j2
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{% if zimbra_domains is defined %}
|
||||||
|
{% for domain in zimbra_domains %}
|
||||||
|
cd {{ domain.name }} o {{ domain.o | default('--')}}
|
||||||
|
{% if domain.accounts is defined %}
|
||||||
|
{% for account in domain.accounts %}
|
||||||
|
ca {{ account.name }} {{ password | default(12345678)}} zimbraIsAdminAccount {{zimbra_is_admin_account | default('FALSE')}} zimbraIsDomainAdminAccount {{ zimbra_is_domain_admin_account | default('FALSE') }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% if domain.distribution_lists is defined %}
|
||||||
|
{% for dl in domain.distribution_lists %}
|
||||||
|
cdl {{ dl.name }}
|
||||||
|
{% if dl.members is defined %}
|
||||||
|
{% for member in dl.members %}
|
||||||
|
adlm {{ dl.name }} {{ member }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% if dl.authorized_senders is defined %}
|
||||||
|
{% for user in dl.authorized_senders %}
|
||||||
|
grr dl {{ dl.name }} usr {{ user }} sendToDistList
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
18
vars/Ubuntu.yml
Normal file
18
vars/Ubuntu.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
# vars file for cartertdte.mta
|
||||||
|
zimbra_required_packages:
|
||||||
|
- netcat
|
||||||
|
- sudo
|
||||||
|
- libidn11
|
||||||
|
- libgmp10
|
||||||
|
- libaio1
|
||||||
|
- libstdc++6
|
||||||
|
- unzip
|
||||||
|
- perl
|
||||||
|
- libperl5.18
|
||||||
|
- pax
|
||||||
|
- sysstat
|
||||||
|
- sqlite3
|
||||||
|
- resolvconf
|
||||||
|
- dnsmasq
|
||||||
|
- wget
|
15
vars/main.yml
Normal file
15
vars/main.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
# vars file for cartertdte.mta
|
||||||
|
zimbra_required_packages:
|
||||||
|
- nc
|
||||||
|
- sudo
|
||||||
|
- libidn
|
||||||
|
- gmp
|
||||||
|
- libaio
|
||||||
|
- libstdc++
|
||||||
|
- unzip
|
||||||
|
- perl-5.10.1
|
||||||
|
- sysstat
|
||||||
|
- sqlite
|
||||||
|
- libreoffice
|
||||||
|
- libreoffice-headless
|
Loading…
Reference in New Issue
Block a user