Skip to content

infn-datacloud/ansible-role-jupyterhub-env

 
 

Repository files navigation

ansible-role-jupyterhub-env Ansible Lint

A role to setup a node with a jupyterhub that spawns jupyterlab with or without GPU utilization and a monitoring service.

Requirements

This role needs a working IAM Client in order to configure the JupyterHub authentication plugin.

Mandatory role variables to provides:

  • iam_url
  • iam_client_id
  • iam_token

Role Variables

defaults

Variable for the monitoring service:

  • install_nvidia_driver: bool (default: yes)
  • install_nvidia_driver_from_cuda: bool (default: yes)
  • install_nvidia_container_toolkit: bool (default: yes)
  • nvidia_driver_skip_reboot: bool (default: yes)
  • gpu_partition_flavor: string, enable the A100 GPU partitioning, four values allowed (default: "None")
  • run_jupyter: bool, if you want to run the jupyterhub compose (default: yes)
  • jupyter_port: string (default: "8888")
  • jupyter_proxy_token: string, token needed for the collaborative service, autogenerated if empty (default: "")
  • jupyter_images: string, Comma separated image list (default: "harbor.cloud.infn.it/datacloud-templates/snj-base-lab:1.2.0")
  • jupyter_use_gpu: bool, if to enable the jupyter notebook to use the GPU (default: no)
  • jupyter_default_spawner: string, indicates to start with lab or notebook (possible values: ["LAB", "NOTEBOOK"])
  • jupyter_post_start_cmd: string, the command to run after jupyter spawned (default: "")
  • jupyter_host_mount_dir: path of base mount point in the host machine (default: "")
  • jupyter_mount_dir: path of mount point in the jupyter env (default: "")
  • jupyterlab_collaborative: bool, if to deploy the collaborative service (default: no)
  • jupyterlab_collaborative_use_gpu: bool, if to enable the collaborative service to use the GPU (default: no)
  • jupyterlab_collaborative_image: string, the collaborative Docker image (default: "harbor.cloud.infn.it/datacloud-templates/snj-base-labc:1.2.0")
  • iam_url: URL of the IAM service (Mandatory)
  • iam_groups: string with the name of the IAM groups allowed (space separated)
  • iam_admin_groups: string with the name of the IAM groups that will be admin (space separated)
  • iam_subject : string, token subject of the user deploying the service
  • iam_client_id: string, IAM client id (Mandatory)
  • iam_token : string, token needed to interact with the IAM Issuer (Mandatory)
  • dns_name: string with the ip or hostname of the current server
  • monitoring: bool, if to deploy the Grafana monitoring service (default: yes)
  • grafana_port: int, the grafana service port
  • grafana_admin_user: string
  • grafana_admin_password: string
  • grafana_image: string (default: "grafana/grafana:9.5.7")
  • cvmfs_repos: string, list of the cvmfs repo to mount (default: "")

vars

The following string variables will be filled with the docker service information:

  • jupyter_gpu: string (default: "WITH_GPU=false")
  • cvmfs_service: string (default: "")
  • compose_base_jhub_image: string (default: "harbor.cloud.infn.it/datacloud-templates/snj-base-jhub:1.2.0")
  • compose_base_http_proxy_image: string (default: "jupyterhub/configurable-http-proxy")
  • compose_base_collab_http_proxy_image: string (default: "harbor.cloud.infn.it/datacloud-templates/snj-base-jlabc-proxy:1.2.0")
  • jupyterlab_collaborative_service: string (default: "")
  • jupyterlab_collaborative_service_dependency: string (default: "")
  • jupyterlab_collaborative_image_param: string (default: "image: harbor.cloud.infn.it/datacloud-templates/snj-base-labc:1.2.0")
  • jupyterlab_collaborative_gpu_param: string (default: "")
  • jupyter_with_cvmfs: bool (default: false)
  • jupyter_collab_service: bool (default: false)
  • gpu_partition_flavor: string, enable the A100 GPU partitioning, four values allowed (default: "None")
  • use_gpu: bool, if the GPU can be used or not (default: no)

Dependencies

  • the following external roles are automatically managed based on the use_gpu and monitoring boolean flags:

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

    - hosts: servers
      roles:
         - role: ansible-role-jupyterhub-env
           dns_name: "a.b.c.d.my.cloud.infn.it"
           jupyterlab_collaborative: yes 
           monitoring: no 
           run_jupyter: no 
           iam_url: https://iam.example.service.it 
           iam_groups: groupA
           iam_client_id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
           iam_token: <TOKEN>

📎 Current status

  • Installation of nvidia cuda driver:
    • Ubuntu (tested on 20.04)
    • RedHat (CentOS)
  • Installation of nvidia-docker2:
    • Ubuntu (tested on 18.04)
  • Installation of docker-compose
  • Installation of Jupyter-Hub from dodas-ts
    • Run the Jupyter-hub

🔗 Useful resources

License

Apache 2.0

Author Information

INFN-DATACLOUD

About

A role to have a nvidia docker environment

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jinja 97.1%
  • Makefile 2.9%