aboutsummaryrefslogblamecommitdiffstats
path: root/roles/nextcloud/tasks/main.yml
blob: 9fd06873250203c41149791eb53708f8109c5a51 (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: 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: 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"

- name: copy dependencies binaries to chroot
  ansible.builtin.include_role:
    name: copy_bin
  vars:
    copy_bin__root_dir: "{{ httpd_pre__chroot_dir }}"
    copy_bin__name: "{{ item }}"
  loop:
    - ffmpeg
    - ffprobe
    - perl

- name: copy dependencies for lowdown
  ansible.builtin.copy:
    src: /usr/local/bin/exiftool
    dest: "{{ httpd_pre__chroot_dir }}/bin/exiftool"
    mode: preserve
    remote_src: true
remember that computers suck.