This guide provides a full Ansible playbook to deploy Zimbra Collaboration on compatible hosts.
Note: Zimbra does not provide an official Docker image. Zimbra requires a dedicated server with specific OS requirements. This playbook outlines the installation process.
- name: Deploy Zimbra Collaboration
hosts: zimbra
become: true
vars:
zimbra_domain: example.com
zimbra_hostname: mail
admin_password: generate-secure-password
tasks:
- name: Fail if not Ubuntu or RHEL
fail:
msg: "Zimbra requires Ubuntu 20.04 LTS, RHEL 8+, or AlmaLinux 8+"
when:
- ansible_os_family != "Debian"
- ansible_os_family != "RedHat"
- name: Set hostname
hostname:
name: "{{ zimbra_hostname }}.{{ zimbra_domain }}"
- name: Add hosts entry
lineinfile:
path: /etc/hosts
line: "127.0.0.1 {{ zimbra_hostname }}.{{ zimbra_domain }} {{ zimbra_hostname }}"
- name: Install Zimbra dependencies on Ubuntu
apt:
name:
- netcat-openbsd
- libaio1
- sysstat
- heimdall-frontend
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Download Zimbra installer
get_url:
url: "https://files.zimbra.com/downloads/10.0.7/ZimbraCollaborationServer-10.0.7.tgz"
dest: /tmp/zimbra-installer.tar.gz
mode: "0644"
- name: Extract installer
unarchive:
src: /tmp/zimbra-installer.tar.gz
dest: /tmp/
remote_src: true
creates: /tmp/ZimbraCollaborationServer-10.0.7
- name: Run Zimbra installer (automated)
command: /tmp/ZimbraCollaborationServer-10.0.7/install.sh -s
args:
chdir: /tmp/ZimbraCollaborationServer-10.0.7
register: install_result
changed_when: install_result.rc == 0
- name: Configure Zimbra post-install
command: |
/opt/zimbra/bin/zmprov md {{ zimbra_domain }}
/opt/zimbra/bin/zmprov ca admin@{{ zimbra_domain }} {{ admin_password }}
changed_when: true
Any questions?
Feel free to contact us. Find all contact information on our contact page.