aboutsummaryrefslogblamecommitdiffstats
path: root/roles/nextcloud/tasks/main.yml
blob: 3e143a880a2cdaed64d4c2de4684320ab9e6f652 (plain) (tree)
1
2
3
4
5
6
7






                                             










                                            

















                                                










                                                   




                                                      
                                                     


                






                                                                                          




                                                               
             










                                          




                                               

# nextcloud ~~ roles/nextcloud/tasks/main.yml
# nextcloud setup

---

- name: install nextcloud
  package: 
    name: nextcloud
    state: present

- name: install nextcloud extra dependencies
  package: 
    name: "{{ item }}"
    state: present
  loop:
    - "php-pgsql-7.3.27"
    - "php-pdo_pgsql-7.3.27"

- name: generate nextcloud httpd configuration
  template:
    src: nextcloud.conf.httpd.j2
    dest: /etc/httpd.d/nextcloud.conf
    owner: "{{ user_root }}"
    group: "{{ group_root }}"
    mode: 0644
  when: ansible_distribution == "OpenBSD"

- name: ensure extensions are enabled in php-fpm
  lineinfile:
    path: /etc/php-7.3.ini
    regexp: "{{ item }}"
    line: "{{ item }}"
  loop:
    - extension=curl
    - extension=pdo_pgsql
    - extension=intl

- name: ensure other config are corrects in php-fpm
  lineinfile:
    path: /etc/php-7.3.ini
    regexp: "^{{ item[0] }}*"
    line: "{{ item[0] }}={{ item[1] }}"
  loop:
    - [ "allow_url_fopen", "On" ]
    - [ "upload_max_filesize", "100M" ]
    - [ "post_max_size", "100M" ]
    - [ "memory_limit", "1024M" ]

- name: generate nextcloud custom config
  template:
    src: var-www-nextcloud-config-custom.config.php.j2
    dest: /var/www/nextcloud/config/custom.config.php
    owner: "www"
    group: "www"
    mode: "0644"

- name: copy configuration for domain name and tls in chroot
  shell: |
    mkdir -p /var/www/etc/ssl
    install -m 444 -o root -g bin /etc/resolv.conf /var/www/etc
    install -m 444 -o root -g bin /etc/ssl/cert.pem /etc/ssl/openssl.cnf /var/www/etc/ssl/

- name: enable cron job for nextcloud indexing and housekeeping
  cron:
    name: "nextcloud indexing"
    minute: "*/5"
    job: "php -f /var/www/nextcloud/cron.php"
    user: www

- name: ensure directories are chow to www
  file:
    path: "/var/www/nextcloud/{{ item }}"
    owner: "www"
    group: "www"
    recurse: true
  loop:
    - "apps"
    - "updater"

- name: ensure php-fpm is restarted and enabled
  service:
    name: php73_fpm
    state: restarted
    enabled: true
remember that computers suck.