blob: e6f41f11aa3af0ebbec4138a3e3369d74795f93e (
plain) (
tree)
|
|
---
- name: maintenance:install nextcloud
ansible.builtin.command:
argv:
- "{{ nextcloud__php_bin }}"
- occ
- maintenance:install
- --database=pgsql
- "--database-name={{ nextcloud__db_name }}"
- "--database-port={{ postgresql__port }}"
- "--database-user={{ nextcloud__db_user }}"
- "--database-pass={{ nextcloud__db_password }}"
- "--database-host={{ nextcloud__db_host }}"
- "--admin-email={{ nextcloud__admin_email }}"
- "--admin-user={{ nextcloud__admin_name }}"
- "--admin-pass={{ nextcloud__admin_password }}"
chdir: "{{ httpd_pre__chroot_dir }}/nextcloud"
creates: "{{ nextcloud__data_dir }}/appdata_*"
register: nextcloud__result_maintenance_install
failed_when:
- nextcloud__result_maintenance_install.rc != 0
- '"is not defined" is not in nextcloud__result_maintenance_install.stderr'
changed_when:
- '"is not defined" is not in nextcloud__result_maintenance_install.stderr'
- name: set system settings
ansible.builtin.command:
cmd: "{{ nextcloud__php_bin }} occ config:system:set {{ item.option }} {{ item.value }}"
chdir: "{{ httpd_pre__chroot_dir }}/nextcloud"
loop: "{{ nextcloud__occ_system_settings }}"
- name: disable applications
ansible.builtin.command:
cmd: "{{ nextcloud__php_bin }} occ app:enable {{ item }}"
chdir: "{{ httpd_pre__chroot_dir }}/nextcloud"
loop: "{{ nextcloud__disabled_apps }}"
register: nextcloud__result_disable_applications
changed_when:
- "'already disabled' not in nextcloud__result_disable_applications.stdout"
- name: enable applications
ansible.builtin.command:
cmd: "{{ nextcloud__php_bin }} occ app:enable {{ item }}"
chdir: "{{ httpd_pre__chroot_dir }}/nextcloud"
loop: "{{ nextcloud__enabled_apps }}"
register: nextcloud__result_enable_applications
changed_when:
- "'already enabled' not in nextcloud__result_enable_applications.stdout"
# - name: enable encryption
# ansible.builtin.command:
# cmd: "{{ nextcloud__php_bin }} occ encryption:enable"
# chdir: "{{ httpd_pre__chroot_dir }}/nextcloud"
# register: nextcloud__result_enable_encryption
# changed_when:
# - "'already enabled' not in nextcloud__result_enable_encryption.stdout"
- name: create application users
ansible.builtin.command:
argv:
- "{{ nextcloud__php_bin }}"
- occ
- user:add
- --password-from-env
- "--display-name={{ item.display_name }}"
- "{{ item.username }}"
chdir: "{{ httpd_pre__chroot_dir }}/nextcloud"
environment:
OC_PASS: "{{ lookup(
'ansible.builtin.password',
'secrets/files/passwords/' + inventory_hostname + '_nextcloud__user_' + item.username + '.txt',
)}}"
loop: "{{ nextcloud__users }}"
register: nextcloud__result_create_application_users
failed_when:
- nextcloud__result_create_application_users.rc == 1
- '"already exists" not in nextcloud__result_create_application_users.stdout'
changed_when:
- '"already exists" not in nextcloud__result_create_application_users.stdout'
- name: update application users
ansible.builtin.command:
argv:
- "{{ nextcloud__php_bin }}"
- occ
- user:setting
- "{{ item.0.username }}"
- settings
- "{{ item.1 }}"
- "{{ item.0[item.1] }}"
chdir: "{{ httpd_pre__chroot_dir }}/nextcloud"
with_nested:
- "{{ nextcloud__users }}"
- ["email"]
|