- name: See if Nextcloud version page exists 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 set_fact: nextcloud_force_install: True when: not nextcloud_page.stat.exists # - 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: url: "{{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file }}" dest: "{{ downloads_dir }}/{{ nextcloud_src_file }}" timeout: "{{ download_timeout }}" #force: yes #validate_certs: False # TEMPORARY ON/AFTER 2018-07-22 AS download.nextcloud.com CERT EXPIRED: https://github.com/iiab/iiab/issues/954 when: internet_available and nextcloud_force_install #async: 1800 #poll: 10 tags: - download # Ubuntu and Debian treat names differently - name: Install 3 php packages (debian) package: name: - "libapache2-mod-php{{ php_version }}" - "php{{ php_version }}-mbstring" - "php{{ php_version }}-zip" state: present when: is_debian # Ubuntu and Debian treat names differently - name: Install 4 php packages (ubuntu) package: name: - libapache2-mod-php - php-imagick - php-zip - php-mbstring state: present when: is_ubuntu - name: Install 5 more php packages (debuntu) package: name: - "php{{ php_version }}-gd" - "php{{ php_version }}-json" - "php{{ php_version }}-mysql" - "php{{ php_version }}-curl" - "php{{ php_version }}-intl" state: present when: is_debuntu - name: 'Install php{{ php_version }}-mcrypt (debuntu but not ubuntu-18) NOTE: php7.2 dropped mcrypt' package: name: "php{{ php_version }}-mcrypt" state: present when: is_debuntu and not is_ubuntu_18 # we need to install the rpm in order to get the dependencies # but we only need to do this the first time - name: Install 7 php packages (redhat) package: name: - php - php-gd - php-json - php-mysql - php-curl - php-intl - php-mcrypt # CentOS does not have a package for php-imagick #- php-imagick state: present when: is_redhat - name: Unpack {{ nextcloud_src_file }} to permanent location /opt/nextcloud unarchive: src: "{{ downloads_dir }}/{{ nextcloud_src_file }}" dest: "{{ nextcloud_prefix }}" #creates: "{{ nextcloud_prefix }}/nextcloud/version.php" when: nextcloud_force_install - name: In CentOS, the following config dir is symlink to /etc/nextcloud file: path: /etc/nextcloud state: directory when: is_centos - name: Add autoconfig file (CentOS) template: src: autoconfig.php.j2 dest: "{{ nextcloud_prefix }}/nextcloud/config/autoconfig.php" owner: "{{ apache_user }}" group: "{{ apache_user }}" mode: 0640 when: is_centos - name: Make Apache owner file: path: "{{ nextcloud_prefix }}/nextcloud" owner: "{{ apache_user }}" group: "{{ apache_user }}" recurse: yes state: directory - name: Create data directory library file: path: "{{ item }}" owner: "{{ apache_user }}" group: "{{ apache_user }}" mode: 0750 state: directory with_items: - "{{ nextcloud_data_dir }}" - name: Create MySQL database {{ nextcloud_dbname }} for Nextcloud mysql_db: name: "{{ nextcloud_dbname }}" when: mysql_enabled and nextcloud_enabled - name: Create username/password for Nextcloud database mysql_user: name: "{{ nextcloud_dbuser }}" host: "{{ item }}" password: "{{ nextcloud_dbpassword }}" priv: "{{ nextcloud_dbname }}.*:ALL,GRANT" with_items: - "{{ nextcloud_dbhost }}" - 127.0.0.1 - ::1 - localhost when: mysql_enabled and 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 - include_tasks: nextcloud_enabled.yml - name: Add 'nextcloud' to list of services at {{ iiab_ini_file }} ini_file: dest: "{{ iiab_ini_file }}" section: Nextcloud option: "{{ item.option }}" value: "{{ item.value }}" with_items: - option: name value: Nextcloud - option: description value: '"NextCloud is a local server-based facility for sharing files, photos, contacts, calendars, etc."' - option: path value: "{{ nextcloud_prefix }}/nextcloud" - option: source value: "{{ nextcloud_src_file }}" - option: enabled value: "{{ nextcloud_enabled }}"