aboutsummaryrefslogblamecommitdiffstats
path: root/roles/nextcloud/tasks/main.yml
blob: 2a1a0bc2599f7c9ce7117ebfa6499213a847b252 (plain) (tree)





















                                                                 


















































                                                                       

                                             
                    








                                                             
---

- 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: database.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: enable nextcloud background jobs
  ansible.builtin.cron:
    name: nextcloud background jobs
    minute: "*/5"
    job: "php  -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.