Minor fixes and cleanup nextcloud role.

This commit is contained in:
Andreas B. Mundt 2020-01-19 18:47:12 +01:00
parent 0a32f99552
commit 985cc477b5
5 changed files with 28 additions and 17 deletions

1
host_vars/blackbox.yml Normal file
View file

@ -0,0 +1 @@
allow_download: True

1
host_vars/bluebox.yml Normal file
View file

@ -0,0 +1 @@
allow_download: True

View file

@ -4,3 +4,4 @@ nc_admin_pwd_file: "/root/nc-admin.pwd"
www_root: "/var/www" www_root: "/var/www"
nc_dir: "{{ www_root }}/nextcloud" nc_dir: "{{ www_root }}/nextcloud"
data_dir: "/var/nc-data" data_dir: "/var/nc-data"
allow_download: False

View file

@ -15,4 +15,4 @@
name: nextcloudcron.timer name: nextcloudcron.timer
state: started state: started
enabled: True enabled: True
listen: "enable nextcloudcron.service" listen: "enable nextcloudcron.timer"

View file

@ -1,4 +1,24 @@
## Install and configure nextcloud ## Install and configure nextcloud.
- name: check if we are installing
stat: path="{{ nc_dir }}"
register: nextcloud
- name: check for nextcloud archive
local_action: stat path=nextcloud.tar.bz2
become: No
register: nc_archive
when: not nextcloud.stat.exists
- name: stop if nextcloud archive is unavailable
fail:
msg: >
The nextcloud archive nextcloud.tar.bz2 is not available.
Download the latest stable release from 'nextcloud.com',
check the signature, rename it and copy it next to 'cloudbox.yml'.
when: not nextcloud.stat.exists and not nc_archive.stat.exists
## We can start with the installation now:
- name: install apache, php- and db-packages - name: install apache, php- and db-packages
apt: apt:
@ -113,12 +133,7 @@
owner: www-data owner: www-data
group: www-data group: www-data
## install nextcloud: ## install nextcloud:
- name: check if we are installing
stat: path="{{ nc_dir }}"
register: nextcloud
- name: create database with name 'nextcloud' - name: create database with name 'nextcloud'
mysql_db: mysql_db:
login_unix_socket: /var/run/mysqld/mysqld.sock login_unix_socket: /var/run/mysqld/mysqld.sock
@ -186,15 +201,7 @@
with_items: with_items:
- nextcloudcron.service - nextcloudcron.service
- nextcloudcron.timer - nextcloudcron.timer
register: nextcloudcron notify: "enable nextcloudcron.timer"
notify: "enable nextcloudcron.service"
- name: switch to systemd timer
command: sudo -u www-data php ./occ background:cron
args:
chdir: "{{ nc_dir }}"
warn: False
when: nextcloudcron.changed
- name: check/run upgrade - name: check/run upgrade
command: sudo -u www-data php updater.phar --no-interaction command: sudo -u www-data php updater.phar --no-interaction
@ -203,6 +210,7 @@
warn: False warn: False
register: cmd_result register: cmd_result
changed_when: cmd_result.stdout is not search('Nothing to do.') changed_when: cmd_result.stdout is not search('Nothing to do.')
when: allow_download
### app installations: ### app installations:
- name: install extra apps - name: install extra apps
@ -216,7 +224,7 @@
register: cmd_result register: cmd_result
changed_when: cmd_result.stdout is not search('already installed') changed_when: cmd_result.stdout is not search('already installed')
failed_when: cmd_result.stdout is not search('already installed') and cmd_result.rc != 0 failed_when: cmd_result.stdout is not search('already installed') and cmd_result.rc != 0
when: allow_download
## ToDo kerberox integration: ## ToDo kerberox integration:
# sudo -u www-data php ./occ app:enable user_ldap # sudo -u www-data php ./occ app:enable user_ldap