ansible-role-jupyter/tasks/main.yml

82 lines
2.8 KiB
YAML

---
- 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
- 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=0750
- 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={{ item.name }} dest={{ jupyter_hub_conf }} mode='0640' owner=root group={{ jupyter_hub_user }}
with_items: '{{ jupyter_hub_system_files }}'
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
- 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: Integrate Spark and Scala
command: coursier launch --fork almond:0.5.0 --scala {{ jupyter_spark_scala_version }} -- --install
when:
- jupyter_is_hadoop_node
tags: [ 'jupyter', 'jupyter_hub', 'spark' ]
- name: Jupyterhub and Plotly
block:
- name: Install the Jupyter plotly extension
command: jupyter labextension install jupyterlab-plotly@{{ jupyter_plotly_version }}
when:
- jupyter_plotly_integration
tags: [ 'jupyter', 'jupyter_hub', 'plotly' ]