From bc1652d42c805e90e5262a06005195fce8709633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sun, 14 Sep 2025 14:05:44 +0300 Subject: [PATCH] Change Nextcloud port --- files/nextcloud/config/apache2/ports.conf | 1 + .../apache2/sites-enabled/000-default.conf | 29 ++++++++++++++++ tasks/deployer.yml | 33 +++++++++++++++++-- 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 files/nextcloud/config/apache2/ports.conf create mode 100644 files/nextcloud/config/apache2/sites-enabled/000-default.conf diff --git a/files/nextcloud/config/apache2/ports.conf b/files/nextcloud/config/apache2/ports.conf new file mode 100644 index 0000000..3cc6764 --- /dev/null +++ b/files/nextcloud/config/apache2/ports.conf @@ -0,0 +1 @@ +Listen 8080 diff --git a/files/nextcloud/config/apache2/sites-enabled/000-default.conf b/files/nextcloud/config/apache2/sites-enabled/000-default.conf new file mode 100644 index 0000000..36e681d --- /dev/null +++ b/files/nextcloud/config/apache2/sites-enabled/000-default.conf @@ -0,0 +1,29 @@ + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + #ServerName www.example.com + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + diff --git a/tasks/deployer.yml b/tasks/deployer.yml index 90b7c39..45c1418 100644 --- a/tasks/deployer.yml +++ b/tasks/deployer.yml @@ -922,11 +922,38 @@ - nextcloud - cloud +- name: "Deployer - Nextcloud - Files - Create Subfolders" + ansible.builtin.file: + dest: '/root/data/nextcloud/{{ item.path }}' + state: directory + with_filetree: './files/nextcloud/' + loop_control: + label: "{{ item.path }}" + when: + - item.state == 'directory' + tags: + - nextcloud + - cloud + +- name: "Deployer - Nextcloud - Files - Generating & Transferring Files" + ansible.builtin.template: + src: '{{ item.src }}' + dest: '/root/data/nextcloud/{{ item.path }}' + register: deployerTaskE1 + with_filetree: './files/nextcloud/' + loop_control: + label: "{{ item.path }}" + when: + - item.state == 'file' + tags: + - nextcloud + - cloud + - name: "Deployer - Nextcloud - Pull Image" containers.podman.podman_image: name: docker.io/library/nextcloud tag: production - register: deployerTaskE1 + register: deployerTaskE2 - name: "Deployer - Nextcloud - Run Container" containers.podman.podman_container: @@ -940,6 +967,8 @@ - "/root/data/nextcloud/config:/var/www/html/config" - "/root/data/nextcloud/apps:/var/www/html/custom_apps" - "/root/data/nextcloud/data:/var/www/html/data" + - "/root/data/nextcloud/config/apache2/ports.conf:/etc/apache2/ports.conf:ro" + - "/root/data/nextcloud/config/apache2/sites-enabled/000-default.conf:/etc/apache2/sites-enabled/000-default.conf:ro" restart_policy: always env: MYSQL_HOST: "127.0.0.1" @@ -951,7 +980,7 @@ NEXTCLOUD_TRUSTED_DOMAINS: "cloud.tjas" OVERWRITEPROTOCOL: "https" when: - - (deployerTaskE1 is defined and deployerTaskE1.changed) or deployerTaskE1 is undefined + - (deployerTaskE1 is defined and deployerTaskE1.changed) or deployerTaskE1 is undefined or (deployerTaskE2 is defined and deployerTaskE2.changed) or deployerTaskE2 is undefined tags: - nextcloud - cloud