From fafc5b128a6e0ffec98472798f00353f8d0adb6c Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 1 Sep 2020 16:00:11 +0200 Subject: [PATCH] Fix the installation of the scala plugin. It must be global. --- tasks/main.yml | 21 +++++++++++++++------ vars/main.yml | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 7c1b9fd..d4e784b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,13 +5,16 @@ user: name={{ jupyter_hub_user }} home={{ jupyter_hub_user_home }} createhome=no shell=/usr/sbin/nologin system=yes - name: Create the jupyterhub home, if it does not exist - file: dest={{ jupyter_hub_user_home }} owner={{ jupyter_hub_user }} group={{ jupyter_hub_user }} state=directory recurse=yes + file: dest={{ jupyter_hub_user_home }} owner={{ jupyter_hub_user }} group={{ jupyter_hub_user }} state=directory recurse=yes mode='0750' + + - name: Create the jupyterhub base directory + file: dest={{ jupyter_hub_base_dir }} owner=root group=root state=directory recurse=yes mode='0755' - name: Create a configuration directory for jupyter hub - file: dest={{ jupyter_hub_conf_dir }} state=directory owner=root group={{ jupyter_hub_user }} mode=0750 + file: dest={{ jupyter_hub_conf_dir }} state=directory owner=root group={{ jupyter_hub_user }} mode='0750' - name: Create a data directory for jupyter hub - file: dest={{ jupyter_hub_data_dir }} state=directory owner={{ jupyter_hub_user }} group={{ jupyter_hub_user }} mode=0750 + file: dest={{ jupyter_hub_data_dir }} state=directory owner={{ jupyter_hub_user }} group={{ jupyter_hub_user }} mode='0755' - name: Create a log directory for jupyter hub file: dest={{ jupyter_hub_logdir }} state=directory owner={{ jupyter_hub_user }} group={{ jupyter_hub_user }} mode=0750 @@ -51,7 +54,7 @@ - name: Jupyterhub and SPARK block: - name: Ensure that the spark configuration directory exists - file: dest=/usr/share/jupyter/kernels/pyspark2 state=directory + file: dest=/usr/share/jupyter/kernels/pyspark2 state=directory recurse=yes mode='0755' - name: Install the spark configuration copy: src=spark-kernel.json dest=/usr/share/jupyter/kernels/pyspark2/kernel.json @@ -65,14 +68,20 @@ - name: Download the coursier executable get_url: url=https://git.io/coursier-cli-linux dest=/usr/local/bin/coursier owner=root group=root mode='0555' + - name: Create the coursier cache directory + file: dest={{ jupyter_hub_coursier_cache_dir }} owner=root group=root state=directory recurse=yes mode='0755' + - name: Check if the scala support for jupyter is already installed - stat: path="/root/.local/share/jupyter/kernels/scala" + stat: path="/usr/local/share/jupyter/kernels/scala/launcher.jar" register: jupyter_scala - name: Integrate Spark and Scala - command: /usr/local/bin/coursier launch --fork almond:0.5.0 --scala {{ jupyter_spark_scala_version }} -- --install + command: /usr/local/bin/coursier launch --cache {{ jupyter_hub_coursier_cache_dir }} --fork almond:0.5.0 --scala {{ jupyter_spark_scala_version }} -- --install --global --force when: not jupyter_scala.stat.exists + - name: Fix the scala launcher permissions + file: dest="/usr/local/share/jupyter/kernels/scala/launcher.jar" mode='0644' + when: - jupyter_is_hadoop_node tags: [ 'jupyter', 'jupyter_hub', 'spark' ] diff --git a/vars/main.yml b/vars/main.yml index 1258cfe..fbf168d 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -14,6 +14,7 @@ jupyter_hub_conf: '{{ jupyter_hub_conf_dir }}/jupyterhub_config.py' jupyter_hub_venv_dir: '/opt/{{ jupyter_hub_venv }}' jupyter_hub_logdir: /var/log/jupyter jupyter_hub_user: jhub +jupyter_hub_coursier_cache_dir: '{{ jupyter_hub_base_dir }}/cs_cache' py3_env_install: True # Always install everything