Pārlūkot izejas kodu

more improvements

master
vecāks
revīzija
cc8cb3f30d
14 mainītis faili ar 88 papildinājumiem un 41 dzēšanām
  1. +5
    -2
      defaults/main.yml
  2. +13
    -5
      tasks/access.yml
  3. +5
    -0
      tasks/apache2.yml
  4. +4
    -4
      tasks/apps.yml
  5. +3
    -3
      tasks/check.yaml
  6. +5
    -5
      tasks/configure.yml
  7. +29
    -10
      tasks/core.yml
  8. +10
    -3
      tasks/install.yml
  9. +1
    -1
      tasks/main.yml
  10. +6
    -1
      tasks/reset.yml
  11. +1
    -1
      tasks/upgrade.yml
  12. +4
    -4
      templates/apache-vhost.conf.j2
  13. +1
    -1
      templates/config.php.j2
  14. +1
    -1
      templates/nextcloud-cron.service

+ 5
- 2
defaults/main.yml Parādīt failu

@@ -2,9 +2,12 @@ nextcloud_state: installed

nextcloud_archive_directory: /opt/nextcloud

nextcloud_directory: /var/www/nextcloud
nextcloud_directory: /var/www/nextcloud-{{nextcloud_version}}

nextcloud_data_directory: /var/lib/nextcloud/data
nextcloud_lib_directory: /var/lib/nextcloud
nextcloud_data_directory: "{{nextcloud_lib_directory}}/data"

nextcloud_log_directory: /var/log/nextcloud

nextcloud_version: 14.0.3



+ 13
- 5
tasks/access.yml Parādīt failu

@@ -2,7 +2,7 @@

- name: nextcloud directory
file:
path: /var/www/nextcloud
path: "{{nextcloud_directory}}"
state: directory
owner: root
group: www-data
@@ -10,7 +10,7 @@

- name: nextcloud subdirectories
file:
path: /var/www/nextcloud/{{item}}
path: "{{nextcloud_directory}}/{{item}}"
state: directory
owner: www-data
group: www-data
@@ -20,7 +20,14 @@
- apps
- themes
- updater
- data

- name: nextcloud data directory
file:
path: "{{nextcloud_lib_directory}}"
state: directory
owner: www-data
group: www-data
mode: 0750

- name: nextcloud data directory
file:
@@ -28,18 +35,19 @@
state: directory
owner: www-data
group: www-data
mode: 0750
recurse: yes

- name: nextcloud log directory
file:
path: /var/log/nextcloud
path: "{{nextcloud_log_directory}}"
state: directory
owner: www-data
group: www-data

- name: nextcloud htaccess webserver access
file:
path: /var/www/nextcloud/.htaccess
path: "{{nextcloud_directory}}/.htaccess"
state: file
owner: www-data
group: www-data


+ 5
- 0
tasks/apache2.yml Parādīt failu

@@ -28,3 +28,8 @@
src: apache2-ports.conf.j2
dest: /etc/apache2/ports.conf
notify: restart apache2

- name: start apache2
service:
name: apache2
state: started

+ 4
- 4
tasks/apps.yml Parādīt failu

@@ -3,7 +3,7 @@
- name: occ app list
command: php occ app:list
args:
chdir: /var/www/nextcloud
chdir: "{{nextcloud_directory}}"
register: _nextcloud_occ_app_list
changed_when: false
become: true
@@ -14,7 +14,7 @@
command: php occ app:install {{item}}
with_items: "{{ nextcloud_apps | difference(_nextcloud_apps_present) }}"
args:
chdir: /var/www/nextcloud
chdir: "{{nextcloud_directory}}"
become: true
become_user: www-data
become_method: sudo
@@ -22,7 +22,7 @@
- name: occ app list
command: php occ app:list
args:
chdir: /var/www/nextcloud
chdir: "{{nextcloud_directory}}"
register: _nextcloud_occ_app_list
changed_when: false
become: true
@@ -33,7 +33,7 @@
command: php occ app:enable {{item}}
with_items: "{{ nextcloud_apps | difference(_nextcloud_apps_enabled) }}"
args:
chdir: /var/www/nextcloud
chdir: "{{nextcloud_directory}}"
become: true
become_user: www-data
become_method: sudo

+ 3
- 3
tasks/check.yaml Parādīt failu

@@ -3,7 +3,7 @@
- name: nextcloud core integrity check
command: php occ integrity:check-core
args:
chdir: /var/www/nextcloud
chdir: {{nextcloud_directory}}
changed_when: false
become: true
become_user: www-data
@@ -12,7 +12,7 @@
- name: occ app list
command: php occ app:list
args:
chdir: /var/www/nextcloud
chdir: {{nextcloud_directory}}
register: _nextcloud_occ_app_list
changed_when: false
become: true
@@ -23,7 +23,7 @@
command: php occ integrity:check-app {{item}}
with_items: "{{ _nextcloud_apps_present }}"
args:
chdir: /var/www/nextcloud
chdir: {{nextcloud_directory}}
changed_when: false
become: true
become_user: www-data


+ 5
- 5
tasks/configure.yml Parādīt failu

@@ -5,32 +5,32 @@
- name: nextcloud list config
command: php occ config:list
args:
chdir: /var/www/nextcloud
chdir: "{{nextcloud_directory}}"
register: _nextcloud_config_cmd
changed_when: false

- name: nextcloud occ config:app:delete trusted_domains
command: php occ config:system:delete trusted_domains
args:
chdir: /var/www/nextcloud
chdir: "{{nextcloud_directory}}"
when: _nextcloud_config.system.trusted_domains != nextcloud_server_names

- name: nextcloud occ config:system:set trusted_domains
command: php occ config:system:set trusted_domains {{ item.0 }} --value={{ item.1 }}
args:
chdir: /var/www/nextcloud
chdir: "{{nextcloud_directory}}"
with_indexed_items: "{{ nextcloud_server_names }}"
when: _nextcloud_config.system.trusted_domains != nextcloud_server_names

- name: nextcloud occ maintenance:update:htaccess
command: php occ maintenance:update:htaccess
args:
chdir: /var/www/nextcloud
chdir: "{{nextcloud_directory}}"

- name: nextcloud occ background:cron
command: php occ background:cron
args:
chdir: /var/www/nextcloud
chdir: "{{nextcloud_directory}}"

become: true
become_user: www-data


+ 29
- 10
tasks/core.yml Parādīt failu

@@ -5,37 +5,56 @@
url: https://apps.nextcloud.com/api/v1/platforms.json
register: _nextcloud_platforms

- name: nextcloud version dir
file:
path: "{{nextcloud_archive_directory}}/{{ nextcloud_version }}"
state: directory

- name: nextcloud core archive checksum download
get_url:
url: https://download.nextcloud.com/server/releases/nextcloud-{{ nextcloud_version }}.tar.bz2.sha256
dest: "{{nextcloud_archive_directory}}/nextcloud-{{ nextcloud_version }}.tar.bz2.sha256"
dest: "{{nextcloud_archive_directory}}/{{ nextcloud_version }}/nextcloud-{{ nextcloud_version }}.tar.bz2.sha256"

- name: nextcloud core archive checksum
shell: cat "{{nextcloud_archive_directory}}/nextcloud-{{ nextcloud_version }}.tar.bz2.sha256"
shell: cat "{{nextcloud_archive_directory}}/{{ nextcloud_version }}/nextcloud-{{ nextcloud_version }}.tar.bz2.sha256"
register: _nextcloud_server_archive_checksum
changed_when: false

- name: nextcloud core archive download
get_url:
url: https://download.nextcloud.com/server/releases/nextcloud-{{ nextcloud_version }}.tar.bz2
dest: "{{nextcloud_archive_directory}}/nextcloud-{{ nextcloud_version }}.tar.bz2"
dest: "{{nextcloud_archive_directory}}/{{ nextcloud_version }}/nextcloud-{{ nextcloud_version }}.tar.bz2"
checksum: sha256:{{ _nextcloud_server_archive_checksum.stdout_lines[0].split(' ')[0] }}

- name: nextcloud core archive signature download
get_url:
url: https://download.nextcloud.com/server/releases/nextcloud-{{ nextcloud_version }}.tar.bz2.asc
dest: "{{nextcloud_archive_directory}}/nextcloud-{{ nextcloud_version }}.tar.bz2.asc"
dest: "{{nextcloud_archive_directory}}/{{ nextcloud_version }}/nextcloud-{{ nextcloud_version }}.tar.bz2.asc"

- name: nextcloud core archive signature check
command: gpg --no-default-keyring --keyring "{{nextcloud_archive_directory}}/keyring.gpg"
--verify "{{nextcloud_archive_directory}}/nextcloud-{{ nextcloud_version }}.tar.bz2.asc"
"{{nextcloud_archive_directory}}/nextcloud-{{ nextcloud_version }}.tar.bz2"
--verify "{{nextcloud_archive_directory}}/{{ nextcloud_version }}/nextcloud-{{ nextcloud_version }}.tar.bz2.asc"
"{{nextcloud_archive_directory}}/{{ nextcloud_version }}/nextcloud-{{ nextcloud_version }}.tar.bz2"
changed_when: false

- name: nextcloud core extract
- name: nextcloud core archive extract
unarchive:
src: "{{nextcloud_archive_directory}}/nextcloud-{{ nextcloud_version }}.tar.bz2"
src: "{{nextcloud_archive_directory}}/{{ nextcloud_version }}/nextcloud-{{ nextcloud_version }}.tar.bz2"
remote_src: yes
dest: /var/www/
dest: "{{nextcloud_archive_directory}}/{{ nextcloud_version }}"
owner: root
group: www-data
group: root

- name: nextcloud core archive sync
synchronize:
src: "{{nextcloud_archive_directory}}/{{ nextcloud_version }}/nextcloud/"
dest: "{{nextcloud_directory}}"
archive: no
recursive: yes
delegate_to: '{{ inventory_hostname }}'

- name: link to current nextcloud directory
file:
src: "{{nextcloud_directory}}"
dest: /var/www/nextcloud
state: link

+ 10
- 3
tasks/install.yml Parādīt failu

@@ -2,13 +2,19 @@

- name: check for config file
stat:
path: /var/www/nextcloud/config/config.php
path: "{{nextcloud_directory}}/config/config.php"
register: _nextcloud_config_file

- name: stop apache2
service:
name: apache2
state: stopped
when: not _nextcloud_config_file.stat.isreg is defined

- name: nextcloud initial config file
template:
src: config.php.j2
dest: /var/www/nextcloud/config/config.php
dest: "{{nextcloud_directory}}/config/config.php"
owner: www-data
group: www-data
when: not _nextcloud_config_file.stat.isreg is defined
@@ -23,8 +29,9 @@
--database-name "{{ nextcloud_database_name }}"
--database-user "{{ nextcloud_database_user }}"
--database-pass "{{ nextcloud_database_pass }}"
--data-dir "{{ nextcloud_data_directory }}"
args:
chdir: /var/www/nextcloud
chdir: "{{nextcloud_directory}}"
become: true
become_user: www-data
become_method: sudo


+ 1
- 1
tasks/main.yml Parādīt failu

@@ -24,7 +24,7 @@

- import_tasks: apps.yml

- import_tasks: check.yaml
#- import_tasks: check.yaml

- import_tasks: upgrade.yml



+ 6
- 1
tasks/reset.yml Parādīt failu

@@ -1,8 +1,13 @@
---

- name: stop apache2
service:
name: apache2
state: stopped

- name: delete nextcloud directory
file:
path: /var/www/nextcloud
path: "{{nextcloud_directory}}"
state: absent

- name: drop mysql database


+ 1
- 1
tasks/upgrade.yml Parādīt failu

@@ -3,7 +3,7 @@
- name: upgrade nextcloud
command: php occ upgrade
args:
chdir: /var/www/nextcloud
chdir: "{{nextcloud_directory}}"
become: true
become_user: www-data
become_method: sudo

+ 4
- 4
templates/apache-vhost.conf.j2 Parādīt failu

@@ -17,9 +17,9 @@
Include /etc/letsencrypt/options-ssl-apache.conf
{% endif %}

DocumentRoot /var/www/nextcloud
DocumentRoot {{nextcloud_directory}}

<Directory /var/www/nextcloud/>
<Directory {{nextcloud_directory}}/>

Options +FollowSymlinks
AllowOverride All
@@ -28,8 +28,8 @@
Dav off
</IfModule>

SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
SetEnv HOME {{nextcloud_directory}}
SetEnv HTTP_HOME {{nextcloud_directory}}

</Directory>



+ 1
- 1
templates/config.php.j2 Parādīt failu

@@ -8,7 +8,7 @@ $CONFIG = array(
'appcodechecker' => true,
'updatechecker' => true,
'log_type' => 'file',
'logfile' => '/var/log/nextcloud/nextcloud.log',
'logfile' => '{{nextcloud_log_directory}}/nextcloud.log',
'loglevel' => 2,
'logtimezone' => 'UTC',
'appstoreenabled' => true,


+ 1
- 1
templates/nextcloud-cron.service Parādīt failu

@@ -4,7 +4,7 @@ Description=nextcloud cron job
[Service]
User=www-data
Group=www-data
ExecStart=/usr/bin/php -f /var/www/nextcloud/cron.php
ExecStart=/usr/bin/php -f {{nextcloud_directory}}/cron.php

[Install]
WantedBy=basic.target

Notiek ielāde…
Atcelt
Saglabāt