diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index ce5d5085c..a22dfb41a 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -1,17 +1,18 @@ -- name: See if Nextcloud version page exists +- name: Check for existence of /opt/nextcloud/version.php stat: path: "{{ nextcloud_prefix }}/nextcloud/version.php" -# path: "{{ nextcloud_prefix }}/nextcloud/index.php" register: nextcloud_page -- name: FORCE INSTALL OR REINSTALL OR UPGRADE IF /opt/nextcloud/version.php DOESN'T EXIST +- name: FORCE INSTALL OR REINSTALL OR UPGRADE IF {{ nextcloud_prefix }}/nextcloud/version.php DOESN'T EXIST set_fact: nextcloud_force_install: True when: not nextcloud_page.stat.exists # - debug: -# msg: "nextcloud_force_install: {{ nextcloud_force_install }}" +# var: nextcloud_force_install +# - debug: +# msg: "nextcloud_force_install: {{ nextcloud_force_install }}" - name: Download {{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file }} to {{ downloads_dir }}/{{ nextcloud_src_file }} get_url: @@ -89,13 +90,13 @@ #creates: "{{ nextcloud_prefix }}/nextcloud/version.php" when: nextcloud_force_install -- name: In CentOS, the following config dir is symlink to /etc/nextcloud +- name: Create dir /etc/nextcloud (centos) for a subsequent config dir that's symlinked to /etc/nextcloud ? file: path: /etc/nextcloud state: directory when: is_centos -- name: Add autoconfig file (CentOS) +- name: Install {{ nextcloud_prefix }}/nextcloud/config/autoconfig.php from template (centos) template: src: autoconfig.php.j2 dest: "{{ nextcloud_prefix }}/nextcloud/config/autoconfig.php" @@ -104,7 +105,7 @@ mode: 0640 when: is_centos -- name: Make Apache owner +- name: chown -R {{ apache_user }}:{{ apache_user }} {{ nextcloud_prefix }}/nextcloud file: path: "{{ nextcloud_prefix }}/nextcloud" owner: "{{ apache_user }}" @@ -112,22 +113,20 @@ recurse: yes state: directory -- name: Create data directory library +- name: Create data directory {{ nextcloud_data_dir }} # /opt/nextcloud/data file: - path: "{{ item }}" + path: "{{ nextcloud_data_dir }}" owner: "{{ apache_user }}" group: "{{ apache_user }}" mode: 0750 state: directory - with_items: - - "{{ nextcloud_data_dir }}" -- name: Create MySQL database {{ nextcloud_dbname }} for Nextcloud +- name: Create MySQL database {{ nextcloud_dbname }} mysql_db: name: "{{ nextcloud_dbname }}" when: mysql_enabled and nextcloud_enabled -- name: Create username/password for Nextcloud database +- name: Add username/password to the MySQL database (associated with trusted IP's like localhost) mysql_user: name: "{{ nextcloud_dbuser }}" host: "{{ item }}" @@ -140,17 +139,15 @@ - localhost when: mysql_enabled and nextcloud_enabled +# Appears unnec as nextcloud_enabled.yml (just below) does the same +#- name: Restart Apache +# service: +# name: "{{ apache_service }}" +# state: restarted +## when: nextcloud_enabled # taken care of by nextcloud_enabled.yml below +# when: not nextcloud_enabled -- name: Restart Apache, to enable/disable http://box/nextcloud - service: - name: "{{ apache_service }}" - state: restarted -# when: nextcloud_enabled # taken care of by nextcloud_enabled.yml below - when: not nextcloud_enabled - -# Enable nextcloud by copying template to httpd config - -# following enables and disables +# Enables or disable Nextcloud! - include_tasks: nextcloud_enabled.yml - name: Add 'nextcloud' to list of services at {{ iiab_ini_file }} @@ -166,7 +163,11 @@ value: '"NextCloud is a local server-based facility for sharing files, photos, contacts, calendars, etc."' - option: path value: "{{ nextcloud_prefix }}/nextcloud" - - option: source + - option: nextcloud_force_install + value: "{{ nextcloud_force_install }}" + - option: nextcloud_orig_src_file + value: "{{ nextcloud_orig_src_file }}" + - option: nextcloud_src_file value: "{{ nextcloud_src_file }}" - - option: enabled + - option: nextcloud_enabled value: "{{ nextcloud_enabled }}"