You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.6 KiB
YAML
89 lines
2.6 KiB
YAML
4 years ago
|
---
|
||
|
- name: create nextcloud directory
|
||
|
file:
|
||
|
path: "{{ item }}"
|
||
|
state: directory
|
||
|
owner: "{{ nextcloud_user }}"
|
||
|
group: "{{ nextcloud_group }}"
|
||
|
loop:
|
||
|
- "{{ nextcloud_directory }}"
|
||
|
- "{{ nextcloud_directory }}/nextcloud-{{ nextcloud_version }}"
|
||
|
- "{{ nextcloud_datadir }}"
|
||
|
|
||
|
- name: Download Nextcloud release
|
||
|
get_url:
|
||
|
url: "{{ nextcloud_download }}"
|
||
|
dest: "{{ nextcloud_directory }}/nextcloud-{{ nextcloud_version }}.tar.bz2"
|
||
|
owner: "{{ nextcloud_user }}"
|
||
|
group: "{{ nextcloud_group }}"
|
||
|
|
||
|
- name: Extract the nextcloud release
|
||
|
become: yes
|
||
|
become_user: "{{ nextcloud_user }}"
|
||
|
unarchive:
|
||
|
src: "{{ nextcloud_directory }}/nextcloud-{{ nextcloud_version }}.tar.bz2"
|
||
|
dest: "{{ nextcloud_install_directory }}"
|
||
|
remote_src: yes
|
||
|
extra_opts:
|
||
|
- "--strip-components=1"
|
||
|
|
||
|
# TODO: Detect older installed releases
|
||
|
# TODO: copy old nextcloud config
|
||
|
|
||
|
# TODO: only run if not newly installed and when nc should be updated
|
||
|
- name: Put nextcloud into maintenance mode
|
||
|
become: yes
|
||
|
become_user: "{{ nextcloud_user }}"
|
||
|
command: "php occ maintenance:mode --on"
|
||
|
args:
|
||
|
chdir: "{{ nextcloud_directory }}/current"
|
||
|
ignore_errors: yes
|
||
|
|
||
|
# TODO: only run if newly installed, then remove ignore_error
|
||
|
- name: Generate nextcloud config file
|
||
|
become: yes
|
||
|
become_user: "{{ nextcloud_user }}"
|
||
|
command: |
|
||
|
php occ maintenance:install --no-interaction
|
||
|
--database {{ nextcloud_db_type }}
|
||
|
--database-host "{{ nextcloud_db_host }}" \
|
||
|
--database-name {{ nextcloud_db }} \
|
||
|
--database-user {{ nextcloud_db_user }} \
|
||
|
--database-pass {{ nextcloud_db_password }} \
|
||
|
--admin-user {{ nextcloud_admin }} \
|
||
|
--admin-pass {{ nextcloud_admin_password }} \
|
||
|
--data-dir {{ nextcloud_datadir }} \
|
||
|
args:
|
||
|
chdir: "{{ nextcloud_install_directory }}"
|
||
|
creates: "{{ nextcloud_install_directory }}/config/config.php"
|
||
|
ignore_errors: yes
|
||
|
register: setup_nc
|
||
|
|
||
|
- name: Configure nextcloud
|
||
|
become: yes
|
||
|
become_user: "{{ nextcloud_user }}"
|
||
|
command: "php occ config:system:set {{ item.key }} --value {{ item.value }}"
|
||
|
args:
|
||
|
chdir: "{{ nextcloud_install_directory }}"
|
||
|
loop: "{{ nextcloud_config }}"
|
||
|
|
||
|
# TODO: run update command
|
||
|
|
||
|
- name: Symlink current nextcloud version
|
||
|
become: yes
|
||
|
become_user: "{{ nextcloud_user }}"
|
||
|
file:
|
||
|
src: "{{ nextcloud_install_directory }}"
|
||
|
dest: "{{ nextcloud_directory }}/current"
|
||
|
owner: "{{ nextcloud_user }}"
|
||
|
group: "{{ nextcloud_group }}"
|
||
|
state: link
|
||
|
|
||
|
- name: Take nextcloud out of maintenance mode
|
||
|
become: yes
|
||
|
become_user: "{{ nextcloud_user }}"
|
||
|
command: "php occ maintenance:mode --off"
|
||
|
args:
|
||
|
chdir: "{{ nextcloud_directory }}/current"
|
||
|
ignore_errors: yes
|