Skip to content

Instantly share code, notes, and snippets.

@mattvonrocketstein
Last active August 3, 2016 15:21
Show Gist options
  • Save mattvonrocketstein/4b46c138f2787a8674aedf0feb3f4879 to your computer and use it in GitHub Desktop.
Save mattvonrocketstein/4b46c138f2787a8674aedf0feb3f4879 to your computer and use it in GitHub Desktop.
A playbook for building a jupyter notebook with IElixir
# playbook.yml
# installs ielixir/jupyter on a stand-alone docker.
# see: http://mattvonrocketstein.github.io/heredoc/ielixir-notebook-in-docker.html
- hosts: docker
become: yes
become_method: sudo
gather_facts: False
vars:
erls_url: "https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb"
ielixir_repo: "https://github.com/pprzetacznik/IElixir.git"
ielixir_hash: "fb9dc5f0ce"
venv_dir: "/root/venv"
tasks:
- name: Download erlang_solutions
get_url:
url="{{erls_url}}"
dest="/root"
- name: install erlang-solutions_1
command: dpkg -i /root/erlang-solutions_1.0_all.deb
- name: Updating APT cache
apt: update_cache=yes force=yes
- name: Installing erlang, elixir, and python deps
apt:
name: "{{item}}"
with_items:
- esl-erlang
- elixir
- git
- build-essential
- python-virtualenv
# meddle with locales because of the error here:
# warning: the VM is running with native name encoding
# of latin1 which may cause Elixir to malfunction as it
# expects utf8.
- name: Fix locales
locale_gen: name=en_US.UTF-8 state=present
- name: Install notebook
pip:
name: notebook==4.2.1
virtualenv: "{{venv_dir}}"
virtualenv_python: python2.7
- name: Install jupyter
pip:
name: jupyter-console==5.0
virtualenv: "{{venv_dir}}"
virtualenv_python: python2.7
- name: Clone IElixir
git:
repo: "{{ielixir_repo}}"
dest: /root/IElixir
force: yes
update: no
version: "{{ielixir_hash}}"
- name: Run mix tasks
command: "{{item}}"
args:
chdir: /root/IElixir
with_items:
- mix local.hex --force
- mix local.rebar --force
- mix deps.get
- mix compile
- name: Install IElixir kernel
command: ./install_script.sh
args:
chdir: /root/IElixir
creates: /root/.ipython/kernels/ielixir/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment