Browse Source

Fix IJulia install check

Unfortunately, `Pkg.installed('IJulia')` does not throw an exception if
the package is not installed, but it throws an Error if it was installed
already.
remove-logs
Andreas Linz 3 years ago
parent
commit
8d5464f2eb
4 changed files with 8 additions and 4 deletions
  1. +1
    -0
      roles/jupyter/defaults/main.yml
  2. +1
    -1
      roles/jupyter/tasks/ijulia.yml
  3. +5
    -2
      roles/jupyter/tasks/main.yml
  4. +1
    -1
      roles/jupyter/templates/jupyter_notebook_config.py.tmpl

+ 1
- 0
roles/jupyter/defaults/main.yml View File

@ -1,3 +1,4 @@
jupyter_user: jupyter
jupyter_group: jupyter
jupyter_port: 10001
jupyter_notebook_dir: "/home/{{ jupyter_user }}/notebooks"

+ 1
- 1
roles/jupyter/tasks/ijulia.yml View File

@ -3,6 +3,6 @@
package: julia
become: true
- name: Install IJulia
command: julia --print 'try Pkg.installed("IJulia") catch Pkg.add("IJulia") end'
command: julia --print 'try if Pkg.installed("IJulia") == nothing Pkg.add("IJulia") end catch end'
become: true
become_user: "{{ jupyter_user }}"

+ 5
- 2
roles/jupyter/tasks/main.yml View File

@ -19,14 +19,17 @@
become: true
become_user: "{{ jupyter_user }}"
command: pip3 install --user jupyter
- name: Create jupyter config directory
- name: Create jupyter config and notebook directory
become: true
file:
path: "/home/{{ jupyter_user }}//.jupyter"
path: "{{ item }}"
owner: "{{ jupyter_user }}"
group: "{{ jupyter_group }}"
state: directory
mode: 0700
with_items:
- "/home/{{ jupyter_user }}//.jupyter"
- "{{ jupyter_notebook_dir }}"
- name: Install jupyter configuration
become: true
template:

+ 1
- 1
roles/jupyter/templates/jupyter_notebook_config.py.tmpl View File

@ -199,7 +199,7 @@ c.NotebookApp.ip = '0.0.0.0'
#c.NotebookApp.nbserver_extensions = {}
## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = ''
c.NotebookApp.notebook_dir = '{{ jupyter_notebook_dir }}'
## Whether to open in a browser after starting. The specific browser used is
# platform dependent and determined by the python standard library `webbrowser`

Loading…
Cancel
Save