aboutsummaryrefslogtreecommitdiffstats
path: root/roles/nextcloud/tasks/main.yml
blob: 1426d4b73e111016d9833c5921b7ef727da88bef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---

- name: install nextcloud
  ansible.builtin.package:
    name: "{{ nextcloud__package_name }}"
    state: present
  register: nextcloud__result_install
  failed_when:
    - nextcloud__result_install.failed
    - not nextcloud__result_install.msg is defined
    - not "because of conflicts" in nextcloud__result_install.msg

- name: update nextcloud
  ansible.builtin.package:
    name: nextcloud
    state: latest

- name: install nextcloud extra dependencies
  package:
    name: "{{ nextcloud__package_dependencies }}"
    state: present

- name: chown directories to www user
  file:
    path: "{{ httpd_pre__chroot_dir }}/nextcloud/{{ item }}"
    owner: "{{ httpd_pre__user }}"
    group: "{{ httpd_pre__group }}"
    recurse: true
  loop: "{{ nextcloud__owned_directories }}"

- name: create .ocdata file
  ansible.builtin.file:
    path: "{{ nextcloud__data_dir }}/.ocdata"
    owner: "{{ httpd_pre__user }}"
    group: "{{ httpd_pre__group }}"
    mode: "0600"
    state: touch

- name: generate datadirectory workaround configuration
  ansible.builtin.template:
    src: datadirectory.config.php.j2
    dest: "{{ nextcloud__chroot_dir }}/config/datadirectory.config.php"
    owner: "{{ httpd_pre__user }}"
    group: "{{ httpd_pre__group }}"
    mode: "0644"

- name: import php tasks
  ansible.builtin.import_tasks:
    file: php.yml

- name: import database tasks
  ansible.builtin.import_tasks:
    file: database.yml
  become: true
  become_user: "{{ postgresql__user }}"

- name: import occ tasks
  ansible.builtin.import_tasks:
    file: occ.yml
  become: true
  become_user: "{{ httpd_pre__user }}"
  become_method: su
  become_flags: -s /bin/sh

- name: import dependencies tasks
  ansible.builtin.import_tasks:
    file: dependencies.yml

- name: enable nextcloud background jobs
  ansible.builtin.cron:
    name: nextcloud background jobs
    minute: "*/5"
    job: "{{ nextcloud__php_bin }} -f {{ nextcloud__chroot_dir }}/cron.php"
    user: "{{ httpd_pre__user }}"

- name: start and enable php-fpm service
  ansible.builtin.service:
    name: "{{ nextcloud__php_service_name }}"
    state: restarted
    enabled: true

- name: generate nextcloud httpd configuration
  template:
    src: nextcloud.conf.httpd.j2
    dest: "{{ httpd_pre__configuration_dir }}/nextcloud.conf"
    owner: 0
    group: 0
    mode: "0644"
remember that computers suck.