mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Check for PHP 7.1+ automatically, for Nextcloud 15/16
This commit is contained in:
parent
b04ac23f42
commit
77d482b2d1
1 changed files with 36 additions and 4 deletions
|
@ -14,6 +14,34 @@
|
||||||
# - debug:
|
# - debug:
|
||||||
# msg: "nextcloud_force_install: {{ nextcloud_force_install }}"
|
# msg: "nextcloud_force_install: {{ nextcloud_force_install }}"
|
||||||
|
|
||||||
|
|
||||||
|
# CHECK FOR PHP VERSION AUTOMATICALLY, TO DETERMINE WHICH NEXTCLOUD TO INSTALL.
|
||||||
|
# INSPIRED BY: github.com/iiab/iiab/blob/master/roles/nodejs/tasks/main.yml#L10-L51
|
||||||
|
|
||||||
|
- name: Try to run 'php -v' to get PHP version
|
||||||
|
shell: php -v | head -1 | sed 's/^[^0-9.]*//' | sed 's/[^0-9.].*//'
|
||||||
|
register: php_version_installed
|
||||||
|
#ignore_errors: yes # NOT NEC: if php is not installed, php_version_installed.stdout will get set to ""
|
||||||
|
|
||||||
|
#- debug:
|
||||||
|
# var: php_version_installed
|
||||||
|
|
||||||
|
- name: Set var 'php_new' to False
|
||||||
|
set_fact:
|
||||||
|
php_new: False # Ansible prefers 'false' but IIAB norm is 'False'
|
||||||
|
#when: php_version_installed.stdout == "" # WORKS TOO, BUT NOT NEC
|
||||||
|
|
||||||
|
- name: Set var 'php_new' indicating if PHP 7.1+ is installed
|
||||||
|
set_fact:
|
||||||
|
php_new: "{{ php_version_installed.stdout is version('7.1', '>=') }}"
|
||||||
|
# Ansible's Version Comparison routine:
|
||||||
|
# https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#version-comparison
|
||||||
|
when: php_version_installed.stdout != "" # IN CASE php NOT INSTALLED
|
||||||
|
|
||||||
|
#- debug:
|
||||||
|
# var: php_new
|
||||||
|
|
||||||
|
|
||||||
- name: Download {{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file_old }} to {{ downloads_dir }}/{{ nextcloud_src_file_old }} on older OS's lacking PHP 7.1+
|
- name: Download {{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file_old }} to {{ downloads_dir }}/{{ nextcloud_src_file_old }} on older OS's lacking PHP 7.1+
|
||||||
get_url:
|
get_url:
|
||||||
url: "{{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file_old }}"
|
url: "{{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file_old }}"
|
||||||
|
@ -25,7 +53,8 @@
|
||||||
#poll: 10
|
#poll: 10
|
||||||
tags:
|
tags:
|
||||||
- download
|
- download
|
||||||
when: internet_available and nextcloud_force_install and (is_debian_9 or is_raspbian_9 or is_ubuntu_16)
|
when: internet_available and nextcloud_force_install and not php_new
|
||||||
|
#when: internet_available and nextcloud_force_install and (is_debian_9 or is_raspbian_9 or is_ubuntu_16)
|
||||||
|
|
||||||
- name: Download {{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file }} to {{ downloads_dir }}/{{ nextcloud_src_file }} on newer OS's that have PHP 7.1+
|
- name: Download {{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file }} to {{ downloads_dir }}/{{ nextcloud_src_file }} on newer OS's that have PHP 7.1+
|
||||||
get_url:
|
get_url:
|
||||||
|
@ -38,7 +67,8 @@
|
||||||
#poll: 10
|
#poll: 10
|
||||||
tags:
|
tags:
|
||||||
- download
|
- download
|
||||||
when: internet_available and nextcloud_force_install and not (is_debian_9 or is_raspbian_9 or is_ubuntu_16)
|
when: internet_available and nextcloud_force_install and php_new
|
||||||
|
#when: internet_available and nextcloud_force_install and not (is_debian_9 or is_raspbian_9 or is_ubuntu_16)
|
||||||
|
|
||||||
# Ubuntu and Debian treat names differently
|
# Ubuntu and Debian treat names differently
|
||||||
- name: Install 3 php packages (debian)
|
- name: Install 3 php packages (debian)
|
||||||
|
@ -103,14 +133,16 @@
|
||||||
src: "{{ downloads_dir }}/{{ nextcloud_src_file_old }}"
|
src: "{{ downloads_dir }}/{{ nextcloud_src_file_old }}"
|
||||||
dest: "{{ nextcloud_prefix }}"
|
dest: "{{ nextcloud_prefix }}"
|
||||||
#creates: "{{ nextcloud_prefix }}/nextcloud/version.php"
|
#creates: "{{ nextcloud_prefix }}/nextcloud/version.php"
|
||||||
when: nextcloud_force_install and (is_debian_9 or is_raspbian_9 or is_ubuntu_16)
|
when: nextcloud_force_install and not php_new
|
||||||
|
#when: nextcloud_force_install and (is_debian_9 or is_raspbian_9 or is_ubuntu_16)
|
||||||
|
|
||||||
- name: Unarchive {{ nextcloud_src_file }} to permanent location {{ nextcloud_prefix }}/nextcloud on newer OS's that have PHP 7.1+ # e.g. unpack nextcloud_latest-16.tar.bz2 to /opt/nextcloud
|
- name: Unarchive {{ nextcloud_src_file }} to permanent location {{ nextcloud_prefix }}/nextcloud on newer OS's that have PHP 7.1+ # e.g. unpack nextcloud_latest-16.tar.bz2 to /opt/nextcloud
|
||||||
unarchive:
|
unarchive:
|
||||||
src: "{{ downloads_dir }}/{{ nextcloud_src_file }}"
|
src: "{{ downloads_dir }}/{{ nextcloud_src_file }}"
|
||||||
dest: "{{ nextcloud_prefix }}"
|
dest: "{{ nextcloud_prefix }}"
|
||||||
#creates: "{{ nextcloud_prefix }}/nextcloud/version.php"
|
#creates: "{{ nextcloud_prefix }}/nextcloud/version.php"
|
||||||
when: nextcloud_force_install and not (is_debian_9 or is_raspbian_9 or is_ubuntu_16)
|
when: nextcloud_force_install and php_new
|
||||||
|
#when: nextcloud_force_install and not (is_debian_9 or is_raspbian_9 or is_ubuntu_16)
|
||||||
|
|
||||||
- name: Create dir /etc/nextcloud (centos) for a subsequent config dir that's symlinked to /etc/nextcloud ?
|
- name: Create dir /etc/nextcloud (centos) for a subsequent config dir that's symlinked to /etc/nextcloud ?
|
||||||
file:
|
file:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue