From b2c12380dc47354973a842368c8a04cea2b4251f Mon Sep 17 00:00:00 2001 From: nd Date: Sat, 22 Sep 2018 19:14:05 +0200 Subject: [PATCH] add mail support --- defaults/main.yml | 3 +++ tasks/main.yml | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 58009e7..16413ca 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,6 +2,9 @@ nextcloud: upload_size_max: 512M datadir: /var/www/nextcloud/data externalurl: example.com + mail: + from: www-data + domain: localhost admin: pw: "{{ lookup('password', '/dev/null') }}" name: admin diff --git a/tasks/main.yml b/tasks/main.yml index 6339bd7..c299ca6 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,4 @@ - name: install nextcloud - register: nextcloudinstall unarchive: src: "https://download.nextcloud.com/server/releases/nextcloud-14.0.0.tar.bz2" remote_src: yes @@ -11,10 +10,10 @@ - name: setup nextcloud become_user: www-data become: true - when: nextcloudinstall is changed command: "/usr/bin/php occ maintenance:install -n --database 'mysql' --database-name '{{ nextcloud.db.name }}' --database-user '{{ nextcloud.db.user }}' --database-pass '{{ nextcloud.db.pw }}' --admin-user '{{ nextcloud.admin.name }}' --admin-pass '{{ nextcloud.admin.pw }}'" args: chdir: /var/www/nextcloud + creates: /var/www/nextcloud/config/config.php - name: set nextcloud trusted domains become_user: www-data @@ -23,6 +22,20 @@ args: chdir: /var/www/nextcloud +- name: set other nextcloud config values + become_user: www-data + become: true + command: '/usr/bin/php occ config:system:set "{{ item.key }}" --value "{{ item.value }}"' + args: + chdir: /var/www/nextcloud + with_items: + - { key: "mail_from_address", value: "{{ nextcloud.mail.from }}" } + - { key: "mail_domain", value: "{{ nextcloud.eail.domain }}" } + - { key: "mail_smtpmode", value: "smtp" } + - { key: "mail_smtpauthtype", value: "PLAIN" } + - { key: "mail_smtphost", value: "{{ mail.server }}" } + - { key: "mail_smtpport", value: "25" } + - name: copy nextcloud nginx config template: src: nginx.j2