mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
60 lines
2.1 KiB
YAML
60 lines
2.1 KiB
YAML
- name: 'Create MySQL database with name: {{ nextcloud_dbname }}'
|
|
mysql_db:
|
|
name: "{{ nextcloud_dbname }}"
|
|
|
|
- name: Add username/password to the MySQL database (associated with trusted IP's like localhost)
|
|
mysql_user:
|
|
name: "{{ nextcloud_dbuser }}"
|
|
host: "{{ item }}"
|
|
password: "{{ nextcloud_dbpassword }}"
|
|
priv: "{{ nextcloud_dbname }}.*:ALL,GRANT"
|
|
with_items:
|
|
- 127.0.0.1
|
|
- ::1
|
|
- localhost
|
|
|
|
|
|
#- name: Install {{ nextcloud_prefix }}/nextcloud/config/autoconfig.php from template
|
|
# template:
|
|
# src: autoconfig.php.j2
|
|
# dest: "{{ nextcloud_prefix }}/nextcloud/config/autoconfig.php"
|
|
# owner: "{{ apache_user }}"
|
|
# group: "{{ apache_user }}"
|
|
# mode: '0640'
|
|
|
|
|
|
- name: Determine if Nextcloud is installed (causes install wizard to fail)
|
|
shell: >
|
|
php {{ nextcloud_prefix }}/nextcloud/occ status |
|
|
gawk '/installed:/ { print $3 }'
|
|
become: yes
|
|
become_user: "{{ apache_user }}"
|
|
register: returned
|
|
|
|
- name: Run Nextcloud initial install wizard (if absolutely nec, manually drop MySQL db '{{ nextcloud_dbname }}')
|
|
shell: >
|
|
cd {{ nextcloud_prefix }}/nextcloud;
|
|
php occ maintenance:install
|
|
--database "mysql"
|
|
--database-name "{{ nextcloud_dbname }}"
|
|
--database-user "{{ nextcloud_dbuser }}"
|
|
--database-pass "{{ nextcloud_dbpassword }}"
|
|
--admin-user "{{ nextcloud_admin_user }}"
|
|
--admin-pass "{{ nextcloud_admin_password }}"
|
|
become: yes
|
|
become_user: "{{ apache_user }}"
|
|
when: returned.stdout == "false" # and nextcloud_enabled
|
|
|
|
|
|
# https://docs.nextcloud.com/server/18/admin_manual/installation/source_installation.html#php-fpm-configuration-notes
|
|
- name: Set 'clear_env = no' in /etc/php/{{ php_version }}/fpm/pool.d/www.conf
|
|
lineinfile:
|
|
path: "/etc/php/{{ php_version }}/fpm/pool.d/www.conf"
|
|
regexp: '^clear_env'
|
|
insertafter: ';.*clear_env'
|
|
line: 'clear_env = no'
|
|
|
|
- name: 'Allow Nextcloud access from all hosts and IP addresses (SEE ALSO: /etc/apache2/sites-available/nextcloud.conf)'
|
|
command: php {{ nextcloud_prefix }}/nextcloud/occ config:system:set trusted_domains 1 --value=*
|
|
become: yes
|
|
become_user: "{{ apache_user }}"
|