From b80fcf9fae1018d5b33599f018aa9e03196bf134 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Tue, 2 May 2017 10:52:32 +0200
Subject: [PATCH] Install oci8.so for PHP 5.6

---
 tasks/oci-5.5.yml |  2 +-
 tasks/oci-5.6.yml | 62 +++++++++++++++++++++++++++++++++++++++++++++++
 tasks/php.yml     | 10 --------
 3 files changed, 63 insertions(+), 11 deletions(-)
 create mode 100644 tasks/oci-5.6.yml

diff --git a/tasks/oci-5.5.yml b/tasks/oci-5.5.yml
index 61ead19..ff3afbb 100644
--- a/tasks/oci-5.5.yml
+++ b/tasks/oci-5.5.yml
@@ -1,4 +1,4 @@
 ---
 # file: roles/php/tasks/oci-5.5.yml
 
-- debug: msg="OCI8 for PHP 5.5 not implemented ywt"
+- debug: msg="OCI8 for PHP 5.5 not implemented yet"
diff --git a/tasks/oci-5.6.yml b/tasks/oci-5.6.yml
new file mode 100644
index 0000000..c33b8b1
--- /dev/null
+++ b/tasks/oci-5.6.yml
@@ -0,0 +1,62 @@
+---
+# file: roles/php/tasks/oci-5.6.yml
+
+- name: "Check OCI Requirement"
+  stat:
+    path: '/usr/lib/php/20131226/oci8.so'
+  register: oci_file
+
+- block:
+
+  - name: "Enable OCI for PHP"
+    copy:
+      content: 'extension={{ item }}.so'
+      dest: '/etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini'
+      owner: 'root'
+      group: 'root'
+      mode: '644'
+    with_items:
+      - 'oci8'
+
+  - name: "Remove possible components in /tmp"
+    file:
+      path: '/tmp/{{ item }}'
+      state: 'absent'
+    with_items:
+      - 'instantclient_11_2'
+      - 'oracle_x64_11_2_0_3_0_oci8_so_php_5_6'
+
+  - name: "Make available Oracle InstantClient"
+    command: scp -r {{ repository }}{{ item }} /tmp/
+    become: no
+    with_items:
+      - 'instantclient_11_2'
+      - 'oracle_x64_11_2_0_3_0_oci8_so_php_5_6'
+
+  - name: "Remove /usr/local/lib/instantclient_11_2"
+    file:
+      path: '/usr/local/lib/instantclient_11_2'
+      state: 'absent'
+
+  - name: "Move Oracle InstantClient to /usr/local/lib"
+    command: mv /tmp/instantclient_11_2 /usr/local/lib/
+
+  - name: "Move oci8 to /usr/lib/php"
+    command: mv /tmp/oracle_x64_11_2_0_3_0_oci8_so_php_4_5 /usr/lib/php/20131226/oci8.so
+
+  - name: "Change ownership for Oracle InstantClient"
+    file:
+      path: '{{ item }}'
+      owner: 'root'
+      group: 'root'
+      recurse: yes
+    with_items:
+      - '/usr/local/lib/instantclient_11_2'
+
+  - name: "Make available libclntsh.so"
+    file:
+      src: '/usr/local/lib/instantclient_11_2/libclntsh.so.11.1'
+      dest: '/usr/local/lib/instantclient_11_2/libclntsh.so'
+      state: 'link'
+
+  when: not oci_file.stat.exists
diff --git a/tasks/php.yml b/tasks/php.yml
index 5f4b50e..c2f4520 100644
--- a/tasks/php.yml
+++ b/tasks/php.yml
@@ -90,16 +90,6 @@
   notify:
     - "Apache | Restart Apache"
 
-- name: "PHP | Enable PHP modules"
-  shell: php5enmod {{ item }}
-  with_items:
-    - mcrypt
-    - imap
-    - imagick
-  when: php_version|default('5.5') != '7' and php_conf_dir == 'mods-available'
-  notify:
-    - "Apache | Restart Apache"
-
 - name: "PHP | Create htdocs directory for apc status"
   file:
     dest=/var/www/apc
-- 
GitLab