From 31cf5cadc969f5188b15f36a36df4890a2704217 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Wed, 4 Nov 2020 12:42:43 +0100
Subject: [PATCH] ansible-inventories/tineon#8943 Enable oracle monitoring with
 netdata

---
 tasks/prepare.yml      | 12 ++++++++++++
 templates/setup.sql.j2 |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/tasks/prepare.yml b/tasks/prepare.yml
index eede347..e4c7974 100644
--- a/tasks/prepare.yml
+++ b/tasks/prepare.yml
@@ -33,3 +33,15 @@
     tag: 18c
     push: no
     source: build
+
+- name: Install Python Library
+  pip:
+    executable: '{{ item }}'
+    name: '{{ packages }}'
+    state: latest
+    vars:
+      packages:
+        - cx_Oracle
+  with_items:
+    - pip3
+    - pip2
diff --git a/templates/setup.sql.j2 b/templates/setup.sql.j2
index 735c477..c44dac6 100644
--- a/templates/setup.sql.j2
+++ b/templates/setup.sql.j2
@@ -3,3 +3,8 @@ alter profile DEFAULT limit password_life_time UNLIMITED;
 create pluggable database {{ oracle_schema }} admin user {{ oracle_schema }} identified by "{{ oracle_password }}" file_name_convert=('/opt/oracle/oradata/XE/pdbseed','/opt/oracle/oradata/XE/{{ oracle_schema }}');
 alter pluggable database {{ oracle_schema }} open read write;
 alter pluggable database all save state;
+
+ALTER SESSION SET "_ORACLE_SCRIPT"=true;
+CREATE USER netdata IDENTIFIED BY netdata;
+GRANT CONNECT TO netdata;
+GRANT SELECT_CATALOG_ROLE TO netdata;
-- 
GitLab