--- - name: Jupyterhub user and directories block: - name: Create the jupyter hub user 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 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' - 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='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 when: jupyter_hub tags: [ 'jupyter', 'jupyter_hub' ] - name: Jupyter HUB software block: - name: Install the jupyter hub systemd unit, rsyslog configuration, logrotate entry template: src={{ item.name }} dest={{ item.dest }} mode='0644' with_items: '{{ jupyter_hub_system_files }}' register: reload_systemd - name: Install the jupyter hub configuration template: src=jupyterhub_config.py.j2 dest={{ jupyter_hub_conf }} mode='0640' owner=root group={{ jupyter_hub_user }} notify: Restart jupyterhub - name: Install the hub configurable proxy npm: name: configurable-http-proxy global: True state: present production: True - name: Reload the systemd configuration systemd: daemon_reload: yes when: reload_systemd is changed - name: Ensure that jupytherhub is running and enabled service: name=jupyterhub state=started enabled=yes when: jupyter_hub tags: [ 'jupyter', 'jupyter_hub' ] - name: Jupyterhub and SPARK block: - name: Ensure that the spark configuration directory exists 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 when: - jupyter_is_hadoop_node tags: [ 'jupyter', 'jupyter_hub', 'spark' ] - name: Jupyterhub, Spark and Scala block: - 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="/usr/local/share/jupyter/kernels/scala/launcher.jar" register: jupyter_scala - name: Integrate Spark and Scala 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' ] - name: Jupyterhub and Plotly block: - name: Check if the jupyter ploty extension is present stat: path="/usr/local/share/jupyter/lab/extensions/jupyterlab-plotly-{{ jupyter_plotly_version }}.tgz" register: jupyterlab_plotly - name: Install the Jupyter plotly extension shell: /usr/local/bin/jupyter labextension install 'jupyterlab-plotly@{{ jupyter_plotly_version }}' when: not jupyterlab_plotly.stat.exists when: - jupyter_plotly_integration tags: [ 'jupyter', 'jupyter_hub', 'plotly' ]