91 lines
4.2 KiB
YAML
91 lines
4.2 KiB
YAML
---
|
|
- block:
|
|
- name: Configure the nextcloud instance
|
|
shell: cd {{ item.doc_root }} && php occ maintenance:install --database="{{ nextcloud_db }}" --database-host "{{ nextcloud_db_host }}" --database-name "{{ nextcloud_db_name }}" --database-user "{{ nextcloud_db_user }}" --database-pass "{{ nextcloud_db_pwd }}" --admin-user "{{ nextcloud_admin_user }}" --admin-pass "{{ nextcloud_admin_u_pwd }}" --data-dir={{ nextcloud_data_dir }} && mkdir {{ nextcloud_data_dir }}/.ht_setup && touch {{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_setup
|
|
args:
|
|
creates: '{{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_setup'
|
|
with_items: '{{ phpfpm_pools }}'
|
|
|
|
- name: Set the trusted domains list
|
|
shell: cd {{ item.webroot }} && php occ config:system:set trusted_domains {{ item.id }} --value={{ item.name }} && touch {{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_trusted_domains_{{ item.id }}
|
|
args:
|
|
creates: '{{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_trusted_domains_{{ item.id }}'
|
|
with_items: '{{ nextcloud_servernames }}'
|
|
|
|
- name: Set the nextcloud log file path
|
|
shell: cd {{ item.doc_root }} && php occ log:file --file {{ nextcloud_log_directory }}/nextcloud.log && touch {{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_logfile
|
|
args:
|
|
creates: '{{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_logfile'
|
|
with_items: '{{ phpfpm_pools }}'
|
|
|
|
- name: Set the audit log file path
|
|
shell: cd {{ item.doc_root }} && php occ config:app:set admin_audit logfile --value={{ nextcloud_log_directory }}/audit.log && touch {{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_logfile
|
|
args:
|
|
creates: '{{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_auditfile'
|
|
with_items: '{{ phpfpm_pools }}'
|
|
|
|
- name: Set the log level
|
|
shell: cd {{ item.doc_root }} && php occ log:manage --level {{ nextcloud_log_level }} && touch {{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_log_level
|
|
args:
|
|
creates: '{{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_log_level'
|
|
with_items: '{{ phpfpm_pools }}'
|
|
|
|
- name: Set the log backend
|
|
shell: cd {{ item.doc_root }} && php occ log:manage --backend {{ nextcloud_log_backend }} && touch {{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_log_backend
|
|
args:
|
|
creates: '{{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_log_backend'
|
|
with_items: '{{ phpfpm_pools }}'
|
|
|
|
- name: Setup the cron configuration
|
|
shell: cd {{ item.webroot }} ; php occ background:cron ; touch {{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_cron
|
|
args:
|
|
creates: 'touch {{ nextcloud_data_dir }}/.ht_setup/ht_nextcloud_cron'
|
|
with_items: '{{ nextcloud_servernames }}'
|
|
tags: [ 'nextcloud', 'nextcloud_config_cron' ]
|
|
|
|
- name: Install the nextcloud cron job
|
|
become_user: root
|
|
cron:
|
|
user: '{{ item.user }}'
|
|
minute: "*/15"
|
|
job: "php -f {{ item.doc_root }}/cron.php"
|
|
name: "NextCloud cron job"
|
|
cron_file: "nextcloud_cron"
|
|
state: present
|
|
disabled: False
|
|
with_items: '{{ phpfpm_pools }}'
|
|
tags: [ 'nextcloud', 'nextcloud_config_cron', 'nextcloud_config' ]
|
|
|
|
become: True
|
|
become_user: '{{ nextcloud_user }}'
|
|
tags: [ 'nextcloud', 'nextcloud_config' ]
|
|
|
|
- block:
|
|
- name: Create the nextcloud encryption keys directory
|
|
become_user: root
|
|
file:
|
|
dest: '{{ nextcloud_oc_dir }}'
|
|
state: directory
|
|
owner: '{{ item.user }}'
|
|
group: '{{ item.user }}'
|
|
with_items: '{{ phpfpm_pools }}'
|
|
when: phpfpm_create_users
|
|
|
|
- name: Create the nextcloud encryption keys directory when the user has been created externally
|
|
file:
|
|
dest: '{{ nextcloud_oc_dir }}'
|
|
state: directory
|
|
with_items: '{{ phpfpm_pools }}'
|
|
when: not phpfpm_create_users
|
|
|
|
- name: Activate global encryption
|
|
shell: cd {{ item.doc_root }} ; php occ app:enable encryption ; php occ encryption:enable ; php occ encryption:enable-master-key ; php occ encryption:change-key-storage-root {{ nextcloud_oc_dir }} ; touch {{ nextcloud_oc_dir }}/.ht_nextcloud_oc
|
|
args:
|
|
creates: '{{ nextcloud_oc_dir }}/.ht_nextcloud_oc'
|
|
with_items: '{{ phpfpm_pools }}'
|
|
|
|
become: True
|
|
become_user: '{{ nextcloud_user }}'
|
|
when: nextcloud_encryption_enabled
|
|
tags: [ 'nextcloud', 'nextcloud_config', 'nextcloud_config_oc' ]
|