Skip to main content

Spawn JupyterHub single user notebook servers using Ansible

Project description

AnsibleSpawner

GitHub Workflow codecov

Spawn JupyterHub single user notebook servers using Ansible.

This spawner runs Ansible playbooks to start, manage and stop JupyterHub singleuser servers. This means any Ansible module can be used to orchestrate your singleuser servers, including Docker and many public/private clouds, and other infrastructure platforms supported by the community. You can do things like create multiple storage volumes for each user, or provision additional services on other containers/VMs.

Prerequisites

Python 3.6 or above and JupyterHub 1.0.0 or above are required.

Installation

Configuration

Example jupyterhub_config.py spawner configuration.

ansible_path = "/path/to/"
c.JupyterHub.spawner_class = "ansible"
c.AnsibleSpawner.inventory = ansible_path + "inventory.yml.j2"
c.AnsibleSpawner.create_playbook = ansible_path + "create.yml"
c.AnsibleSpawner.update_playbook = ansible_path + "update.yml"
c.AnsibleSpawner.poll_playbook = ansible_path + "poll.yml"
c.AnsibleSpawner.destroy_playbook = ansible_path + "destroy.yml"
c.AnsibleSpawner.playbook_vars = {
    "container_image": "docker.io/jupyter/base-notebook",
    "ansible_python_interpreter": "python3",
}
c.AnsibleSpawner.start_timeout = 600
c.JupyterHub.hub_connect_ip = "10.0.0.1"

See the example playbooks under ./examples

Development

Pytest is used to run automated tests that require Docker and Podman. These platforms were chosen because they are self-contained and can be installed in Travis, whereas testing with public cloud platforms requires secure access credentials.

If you only have one of these you can limit tests by specifying a marker. For example, to disable the Docker tests:

pytest -vs -m "not docker"

To view test coverage run pytest with --cov=ansiblespawner --cov-report=html, then open htmlcov/index.html.

setuptools-scm is used to manage versions. Just create a git tag.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansiblespawner-0.0.1.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

ansiblespawner-0.0.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file ansiblespawner-0.0.1.tar.gz.

File metadata

  • Download URL: ansiblespawner-0.0.1.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for ansiblespawner-0.0.1.tar.gz
Algorithm Hash digest
SHA256 379ef5b0a0d125dfdf4248e8446775479669c45a5af3763b6b8bc810b6728d1e
MD5 0b74fbfcb466e0c686875e8ff3032c2b
BLAKE2b-256 11bd02a170729b416a51dcdc3cda8c6c617f85e5693582203b1f673c7e0e40a1

See more details on using hashes here.

File details

Details for the file ansiblespawner-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ansiblespawner-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for ansiblespawner-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f9a484a03f3143eaa965f16ba426964c047f7d0eeb622c4ab6a82a19994b593d
MD5 d80d53ed9d632f0726964fdd7fa0e071
BLAKE2b-256 b71142915662cd32c7fbd0adc202640c1924e400195026534ee18e02bbc22415

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page