ansible-zimbra/tasks/main.yml
2016-05-21 21:06:18 +02:00

87 lines
1.8 KiB
YAML

---
# 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
group=root
mode=0644
notify:
- dnsmasq restart
- name: Set resolv.conf file
template:
src=resolv.conf.j2
dest=/etc/resolv.conf
owner=root
group=root
mode=0644
notify:
- dnsmasq restart
- name: Resolv self hostname via dnsmasq
template:
src=hostname.dnsmasq.j2
dest=/etc/dnsmasq.d/{{ ansible_hostname }}
owner=root
group=root
mode=0644
notify:
- dnsmasq restart
- name: Enable dnsmasq service
service:
name=dnsmasq
enabled=yes
- name: Ensure handlers run now
meta: flush_handlers
- 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
ignore_errors: yes
- include: provision_zimbra.yml