From 91b6c7cdd0717b050a88ed702ff36d1f41ebb44f Mon Sep 17 00:00:00 2001 From: Mohamed Mehdi BEN AISSA Date: Wed, 25 Oct 2023 17:44:43 +0200 Subject: [PATCH] feat(knox): add support of two instances of livy with spark2(livy) and spark3 (livy3) --- .../services/livy3/0.4.3/rewrite.xml.j2 | 58 +++++++++++++++++++ .../services/livy3/0.4.3/service.xml.j2 | 35 +++++++++++ roles/knox/gateway/tasks/config.yml | 25 ++++++++ tdp_vars_defaults/knox/knox.yml | 3 + 4 files changed, 121 insertions(+) create mode 100644 roles/knox/common/templates/services/livy3/0.4.3/rewrite.xml.j2 create mode 100644 roles/knox/common/templates/services/livy3/0.4.3/service.xml.j2 diff --git a/roles/knox/common/templates/services/livy3/0.4.3/rewrite.xml.j2 b/roles/knox/common/templates/services/livy3/0.4.3/rewrite.xml.j2 new file mode 100644 index 00000000..05a48391 --- /dev/null +++ b/roles/knox/common/templates/services/livy3/0.4.3/rewrite.xml.j2 @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/roles/knox/common/templates/services/livy3/0.4.3/service.xml.j2 b/roles/knox/common/templates/services/livy3/0.4.3/service.xml.j2 new file mode 100644 index 00000000..b78dc072 --- /dev/null +++ b/roles/knox/common/templates/services/livy3/0.4.3/service.xml.j2 @@ -0,0 +1,35 @@ + + + + + API_AND_UI + /livy3/ + Livy Server + Apache Livy is a service that enables easy interaction with a Spark cluster over a REST interface. + + + + + + + + + + + + diff --git a/roles/knox/gateway/tasks/config.yml b/roles/knox/gateway/tasks/config.yml index 0214af2f..9c645a92 100644 --- a/roles/knox/gateway/tasks/config.yml +++ b/roles/knox/gateway/tasks/config.yml @@ -72,6 +72,31 @@ group: "{{ knox_group }}" mode: "644" +# Livy Spark 3 service definition +- name: Create Livy Spark 3 service dir + ansible.builtin.file: + path: "{{ knox_data_dir }}/data/services/livy3/0.4.3" + state: directory + owner: "{{ knox_user }}" + group: "{{ knox_group }}" + mode: "755" + +- name: Template Livy Spark 3 service.xml + ansible.builtin.template: + src: services/livy3/0.4.3/service.xml.j2 + dest: "{{ knox_data_dir }}/data/services/livy3/0.4.3/service.xml" + owner: "{{ knox_user }}" + group: "{{ knox_group }}" + mode: "644" + +- name: Template Livy Spark 3 rewrite.xml + ansible.builtin.template: + src: services/livy3/0.4.3/rewrite.xml.j2 + dest: "{{ knox_data_dir }}/data/services/livy3/0.4.3/rewrite.xml" + owner: "{{ knox_user }}" + group: "{{ knox_group }}" + mode: "644" + - name: Template Knox gateway-site.xml ansible.builtin.template: src: gateway-site.xml.j2 diff --git a/tdp_vars_defaults/knox/knox.yml b/tdp_vars_defaults/knox/knox.yml index be9de811..77748914 100644 --- a/tdp_vars_defaults/knox/knox.yml +++ b/tdp_vars_defaults/knox/knox.yml @@ -166,6 +166,9 @@ gateway_topology: hosts: "{{ groups['hbase_master'] | default([]) | map('tosit.tdp.access_fqdn', hostvars) | list }}" port: "{{ hbase_master_info_port }}" LIVYSERVER: + hosts: "{% if groups['livy_server'] is defined %}{{ groups['livy_server'] | default([]) | map('tosit.tdp.access_fqdn', hostvars) | list }}{% else %}{% endif %}" + port: "8998" + LIVYSERVER3: hosts: "{% if groups['livy_spark3_server'] is defined %}{{ groups['livy_spark3_server'] | default([]) | map('tosit.tdp.access_fqdn', hostvars) | list }}{% else %}{% endif %}" port: "8999"