From aaae97604de43897177626b08c8c4233a167d298 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Wed, 13 Jun 2018 13:49:21 +0200
Subject: [PATCH] Prepare support for PHP 7.1

---
 handlers/main.yml   |  2 +-
 tasks/main.yml      |  3 +++
 tasks/oci-7.1.yml   |  4 ++++
 tasks/php.yml       |  5 +++--
 tasks/variables.yml | 10 ++++++++++
 5 files changed, 21 insertions(+), 3 deletions(-)
 create mode 100644 tasks/oci-7.1.yml
 create mode 100644 tasks/variables.yml

diff --git a/handlers/main.yml b/handlers/main.yml
index 4420947..18221b1 100644
--- a/handlers/main.yml
+++ b/handlers/main.yml
@@ -3,5 +3,5 @@
 
 - name: "Restart PHP-FPM"
   service:
-    name: '{{ phpFpmService|default("php7.0-fpm") }}'
+    name: '{{ phpFpmService }}'
     state: 'restarted'
diff --git a/tasks/main.yml b/tasks/main.yml
index b38c020..85605cd 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -11,6 +11,9 @@
 
 - block:
 
+  - include_tasks: 'variables.yml'
+    tags: 'always'
+
   - import_tasks: php.yml
 
   - name: "Link PhpEnMod for PHP 5.3"
diff --git a/tasks/oci-7.1.yml b/tasks/oci-7.1.yml
new file mode 100644
index 0000000..2f75185
--- /dev/null
+++ b/tasks/oci-7.1.yml
@@ -0,0 +1,4 @@
+---
+# file: roles/php/tasks/oci-7.1.yml
+
+- debug: msg="OCI8 for PHP 7.1 not implemented yet"
diff --git a/tasks/php.yml b/tasks/php.yml
index fc851af..bfccb5c 100644
--- a/tasks/php.yml
+++ b/tasks/php.yml
@@ -26,8 +26,9 @@
   when: php_version_main|default('7') != '7'
   ignore_errors: true
 
+# NOTE: If oauth is already installed and we install a new PHP 7 version then this fails and we need --force as well
 - name: "PHP | Install PECL packages"
-  shell: 'pecl install --soft oauth'
+  shell: 'pecl install --soft --force oauth'
   when: php_version_main|default('7') == '7'
   ignore_errors: true
 
@@ -158,7 +159,7 @@
 
 - block:
   - set_fact:
-      phpLogRotatePrefix='7.0'
+      phpLogRotatePrefix='{{php_version|default("7.0")}}'
       phpLibPrefix=''
     when: php_version_main|default('7') == '7'
   - set_fact:
diff --git a/tasks/variables.yml b/tasks/variables.yml
new file mode 100644
index 0000000..5c8b780
--- /dev/null
+++ b/tasks/variables.yml
@@ -0,0 +1,10 @@
+---
+# file: roles/php/tasks/variables.yml
+
+- block:
+  - set_fact: phpFpmService='php5-fpm'
+  - set_fact: phpFpmService='php-fpm'
+    when: php_version_main|default('7') == '5'
+  - set_fact: phpFpmService='php{{php_version|default("7.0")}}-fpm'
+    when: php_version_main|default('7') == '7'
+  tags: 'always'
-- 
GitLab