From 2be8028c5fdd97c001d11d8e9cec78f91deb9943 Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Wed, 7 Dec 2016 14:16:41 +0100 Subject: [PATCH] debian campatibly --- mailserver/tasks/install_debian.yml | 23 +++++++++++++++++++ mailserver/tasks/main.yml | 5 +++- mailserver/tasks/spamassassin.yml | 2 +- warehost-api/templates/warehost-api.unit | 1 - warehost-ftp/templates/warehost-ftp.unit | 1 - warehost-host/templates/warehost-host.service | 1 - warehost-web/templates/warehost-web.unit | 1 - 7 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 mailserver/tasks/install_debian.yml diff --git a/mailserver/tasks/install_debian.yml b/mailserver/tasks/install_debian.yml new file mode 100644 index 0000000..60abb11 --- /dev/null +++ b/mailserver/tasks/install_debian.yml @@ -0,0 +1,23 @@ +--- +- name: Install dependencies + apt: name={{item}} state=present + with_items: + - postfix + - dovecot-imapd + - dovecot-pop3d + - dovecot-pgsql + - dovecot-managesieved + - dovecot-sieve + - spamassassin + - procmail + notify: + - restart postfix + - restart dovecot + + + +- name: Create aliases + file: path=/etc/postfix/{{item}} state=touch + with_items: + - aliases + - transport diff --git a/mailserver/tasks/main.yml b/mailserver/tasks/main.yml index 10c8500..4aa0ca1 100644 --- a/mailserver/tasks/main.yml +++ b/mailserver/tasks/main.yml @@ -1,6 +1,9 @@ --- - include: install_archlinux.yml - when: ansible_os_family == 'Archlinux' + when: (ansible_distribution == "Antergos") or (ansible_os_family == "Archlinux") + +- include: install_debian.yml + when: (ansible_distribution == "Debian") or (ansible_distribution == "Ubuntu") - name: Add service smtp lines lineinfile: dest=/etc/services regexp='^smtps {{item}}' line="smtps {{item}}" diff --git a/mailserver/tasks/spamassassin.yml b/mailserver/tasks/spamassassin.yml index 973d21b..df0fb8e 100644 --- a/mailserver/tasks/spamassassin.yml +++ b/mailserver/tasks/spamassassin.yml @@ -1,6 +1,6 @@ --- - name: Spamassassin update - command: /usr/bin/vendor_perl/sa-update -v + command: sa-update -v register: bass_result changed_when: "bass_result.rc != 1" ignore_errors: yes diff --git a/warehost-api/templates/warehost-api.unit b/warehost-api/templates/warehost-api.unit index f58d4d5..3d7ce62 100644 --- a/warehost-api/templates/warehost-api.unit +++ b/warehost-api/templates/warehost-api.unit @@ -13,7 +13,6 @@ After=postgresql.service #LimitNOFILE=65535 Type=simple User=warehost -Group=nobody ExecStart=/usr/local/bin/warehost-api -c /etc/warehost/api.conf Restart=always diff --git a/warehost-ftp/templates/warehost-ftp.unit b/warehost-ftp/templates/warehost-ftp.unit index 46b8aa7..6bb9e91 100644 --- a/warehost-ftp/templates/warehost-ftp.unit +++ b/warehost-ftp/templates/warehost-ftp.unit @@ -7,7 +7,6 @@ After=postgresql.service [Service] Type=simple User=warehost -Group=nobody ExecStart=/usr/local/bin/warehost-ftp -c /etc/warehost/ftp.conf Restart=always diff --git a/warehost-host/templates/warehost-host.service b/warehost-host/templates/warehost-host.service index 43a6c77..0862b7d 100644 --- a/warehost-host/templates/warehost-host.service +++ b/warehost-host/templates/warehost-host.service @@ -7,7 +7,6 @@ After=postgresql.service [Service] Type=oneshot User=warehost -Group=nobody ExecStart=/usr/local/bin/warehost-host -c /etc/warehost/host.conf PermissionsStartOnly=true ExecStartPost=/usr/bin/systemctl reload {{warehost_host_web_type}} diff --git a/warehost-web/templates/warehost-web.unit b/warehost-web/templates/warehost-web.unit index d65910e..bb2185a 100644 --- a/warehost-web/templates/warehost-web.unit +++ b/warehost-web/templates/warehost-web.unit @@ -13,7 +13,6 @@ After=postgresql.service #LimitNOFILE=65535 Type=simple User=warehost -Group=nobody ExecStart=/usr/local/bin/warehost-web -c /etc/warehost/web.conf Restart=always