ansible-role-nextcloud/tasks/nextcloud.yml

51 lines
1.6 KiB
YAML
Raw Normal View History

2020-12-03 15:52:14 +01:00
---
- name: "Ensure install dir is present"
file:
path: "{{ nextcloud_install_path }}"
mode: 0755
state: directory
- name: "Download und unarchive Nextcloud"
unarchive:
src: "{{ nextcloud_dl_url }}/{{ nextcloud_version }}.tar.bz2"
remote_src: true
extra_opts:
- "--strip-components=1"
dest: "{{ nextcloud_install_path }}"
owner: "{{ common_name }}"
group: "{{ common_name }}"
mode: 0755
- name: "Install Nextcloud"
command: >
php "{{ nextcloud_install_path }}"/occ maintenance:install --database "mysql"
--database-name "{{ nextcloud_mysql_db }}" --database-user "{{ nextcloud_mysql_user }}"
--database-pass 2CHbJwLpXTgHQkiUnFCgoowfT7vQdt85BX7VfRBCtb --database-host "{{ nextcloud_database_host }}"
--admin-user "{{ nextcloud_admin_user }}" --admin-pass "{{ nextcloud_admin_pw }}"
become: true
become_user: "{{ common_name }}"
changed_when: true
- name: "Ensure trusted domains are set"
command: 'php {{ nextcloud_install_path }}/occ config:system:set trusted_domains {{ item.0 }} --value "{{ item.1 }}"'
become: true
become_user: "{{ common_name }}"
changed_when: true
with_indexed_items:
- '{{ nextcloud_trusted_domains }}'
- name: "Ensure Apache marco module is loaded"
apache2_module:
state: present
name: macro
notify: restart apache
- name: "Setup Apache site config"
lineinfile:
path: /etc/apache2/conf-available/nextcloud_sites.conf
insertafter: "^Ansbile"
line: "Use NCSite {{ nextcloud_domain }} {{ common_name }}"
state: present
notify: reload apache