summaryrefslogtreecommitdiff
path: root/roles/nextcloud/tasks/installation.yml
blob: 516081bb0f29106a2fd5237c7f4c04e143c364d0 (plain)
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
- name: install nfs packages
  apt:
    name: '{{ nextcloud_nfs_present }}'
    install_recommends: 'no'
    state: present

- name: check mountpoint exist
  ansible.builtin.file:
    path: "{{ nextcloud_data_dir }}"
    state: directory
    mode: 0640
    owner: www-data
    group: www-data

- name: mount network share
  ansible.posix.mount:
    src: "{{ nextcloud_data_nfs_share }}"
    path: "{{ nextcloud_data_dir }}"
    fstype: nfs
    opts: "rw,sync"
    state: mounted

- name: "nc_installation | Generate password {{ nextcloud_admin_name }}"
  ansible.builtin.set_fact:    
    nextcloud_admin_pwd: "{{ lookup('password', '/root/ncpasswd.txt') }}"
    become: true
  when: nextcloud_admin_pwd is not defined

- name: nc_installation | Set temporary permissions for command line installation
  ansible.builtin.file:
    path: "{{ nextcloud_webroot }}"
    state: directory
    recurse: true
    owner: "{{ nextcloud_websrv_user }}"
    group: "{{ nextcloud_websrv_group }}"

- name: nc_installation | Verify config.php - check filesize
  ansible.builtin.stat:
    path: "{{ nextcloud_webroot }}/config/config.php"
  register: nc_installation_confsize
  failed_when: nc_installation_confsize.stat.size is undefined or nc_installation_confsize.stat.size <= 100

- name: nc_installation | Verify config.php - php syntax check
  ansible.builtin.command: "php -l {{ nextcloud_webroot }}/config/config.php"
  register: nc_installation_confphp
  changed_when: false
  failed_when:
    - nc_installation_confphp.rc is defined
    - nc_installation_confphp.rc != 0

- name: set MAILTO in crontab for Nextcloud
  become: true
  become_user: www-data
  cronvar:
    name: MAILTO
    value: status@iamfabulous.de

- name: set cronjob for Nextcloud
  ansible.builtin.cron:
    name: "runs Nextcloud cron job"
    minute: "*/5"
    user: "{{ nextcloud_websrv_user }}"
    job: "php -f {{ nextcloud_webroot }}/cron.php"