finish and test nextcloud role

This commit is contained in:
2025-02-06 15:00:16 +01:00
parent a729ea3ecf
commit c472672b41
16 changed files with 78 additions and 33 deletions

View File

@@ -1,5 +0,0 @@
site_conf: example.com.conf
php_verison: "8.4"
mysql_db_name: mysql
mysql_db_user: mysql
web_root: "/var/www/{{ hostname }}"

View File

@@ -0,0 +1,5 @@
site_conf: cloud.conf
php_verison: "8.4"
mysql_db_name: nextcloud
mysql_db_user: nextcloud
web_root: "/var/www/nextcloud"

View File

@@ -0,0 +1,5 @@
---
- name: restart apache
service:
name: apache2
state: restarted

View File

@@ -22,9 +22,9 @@
mode: 0644
notify: restart apache
- name: Enable the ownCloud site.
- name: Enable the Nextcloud site.
command: >
a2ensite owncloud.dav
a2ensite {{ site_conf }}
creates="/etc/apache2/sites-enabled/{{ site_conf }}"
notify: restart apache

View File

@@ -7,10 +7,16 @@
- python3-pycurl
- python3-pymysql
- name: Add ondrej repository for later versions of PHP.
apt_repository:
repo: "ppa:ondrej/php"
update_cache: yes
#- name: Add ondrej repository for later versions of PHP.
# apt_repository:
# repo: "ppa:ondrej/php"
# update_cache: yes
#sudo dpkg -l | grep php | tee packages.txt
#sudo apt install apt-transport-https lsb-release ca-certificates wget -y
#sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
#sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
#sudo apt update
- name: "Install Apache, MySQL, PHP, and other dependencies."
apt:
@@ -26,7 +32,7 @@
- mariadb-server
- libpcre3-dev
- apache2
- "libapache2-mod-php{{ php_version }}"
- "libapache2-mod-php"
- "php{{ php_version }}"
- "php{{ php_version }}-imagick"
- "php{{ php_version }}-common"
@@ -34,7 +40,7 @@
- "php{{ php_version }}-gd"
- "php{{ php_version }}-imap"
- "php{{ php_version }}-intl"
- "php{{ php_version }}-json"
#- "php{{ php_version }}-json"
- "php{{ php_version }}-mbstring"
- "php{{ php_version }}-gmp"
- "php{{ php_version }}-bcmath"
@@ -45,7 +51,7 @@
- "php{{ php_version }}-apcu"
- "php{{ php_version }}-redis"
- "php{{ php_version }}-ldap"
- "php{{ php_version }}-smbclient"
#- "php{{ php_version }}-smbclient"
- php-phpseclib
- bzip2
- rsync

View File

@@ -14,3 +14,11 @@
- name: Configure MySQL.
include_tasks:
file: mysql.yml
- name: Create occ helper script.
include_tasks:
file: occ.yml
- name: Download Nextcloud.
include_tasks:
file: nextcloud.yml

View File

@@ -0,0 +1,13 @@
---
- name: Download Nextcloud source.
ansible.builtin.get_url:
url: https://download.nextcloud.com/server/releases/latest.tar.bz2
dest: "/tmp/nextcloud-complete-latest.tar.bz2"
owner: www-data
- name: Extract the archive.
ansible.builtin.unarchive:
src: "/tmp/nextcloud-complete-latest.tar.bz2"
dest: "/var/www/"
owner: www-data
remote_src: yes

View File

@@ -0,0 +1,7 @@
- name: Create a helper script for running occ commands.
template:
src: "templates/occ.j2"
dest: "/usr/local/bin/occ"
owner: root
group: root
mode: 0755

View File

@@ -1,7 +1,7 @@
---
- name: Adjust OpCache memory setting.
lineinfile:
dest: "/etc/php/7.4/apache2/conf.d/10-opcache.ini"
dest: "/etc/php/{{ php_version }}/apache2/conf.d/10-opcache.ini"
regexp: "^opcache.memory_consumption"
line: "opcache.memory_consumption = 96"
state: present

View File

@@ -3,7 +3,7 @@ ServerName {{ hostname }}
DirectoryIndex index.php index.html
DocumentRoot {{ web_root }}
<Directory {{ web_root }}>
Options +FollowSymlinks -Indexes
Options FollowSymLinks MultiViews
AllowOverride All
Require all granted
@@ -11,7 +11,7 @@ DocumentRoot {{ web_root }}
Dav off
</IfModule>
SetEnv HOME {{ web_root }}
SetEnv HTTP_HOME {{ web_root }}
#SetEnv HOME {{ web_root }}
#SetEnv HTTP_HOME {{ web_root }}
</Directory>
</VirtualHost>

View File

@@ -0,0 +1,4 @@
#!/bin/bash
cd /var/www/nextcloud || exit
sudo -E -u www-data /usr/bin/php /var/www/nextcloud/occ "$@"