From dd531017783ae0c4b2f09a59799b033303e3395c Mon Sep 17 00:00:00 2001 From: mortenwh Date: Thu, 4 Jul 2019 11:57:48 +0200 Subject: [PATCH] #30: launch jupyter notebook from ansible playbook --- provisioning/roles/openwind/tasks/main.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/provisioning/roles/openwind/tasks/main.yml b/provisioning/roles/openwind/tasks/main.yml index 4f65b2b..6b39bc9 100644 --- a/provisioning/roles/openwind/tasks/main.yml +++ b/provisioning/roles/openwind/tasks/main.yml @@ -3,6 +3,27 @@ - name: openwind | Add PYTHONPATH to bashrc lineinfile: dest="/home/vagrant/.bashrc" line="export PYTHONPATH=/vagrant" +- name: openwind | Change owner of anaconda directory + shell: 'sudo chown -R vagrant /home/vagrant/anaconda/' + +- name: openwind | Add Jupyter Notebook to crontab + cron: name="Jupyter Notebook" special_time=reboot job="sleep 60; {{ conda_dir }}/envs/{{ env_name }}/bin/jupyter-notebook --ip=0.0.0.0 --no-browser --notebook-dir={{ dev_sources_dir }}/notebooks/ --NotebookApp.token=vagrant" + +- name: openwind | Check if Jupyter is running + shell: ps aux | grep jupyter | grep -v grep + ignore_errors: yes + changed_when: false + register: jupyter_status + +- name: openwind | Launch Jupyter Notebook + shell: "nohup {{ conda_dir }}/envs/{{ env_name }}/bin/jupyter-notebook --ip=0.0.0.0 --no-browser --notebook-dir={{ dev_sources_dir }}/notebooks/ --NotebookApp.token=vagrant > /dev/null 2>&1 &" + when: jupyter_status.rc != 0 + + #- name: Nansat Setup Python | Check if numpy is imported + # shell: "nosetests test_import.py" + # args: + # chdir: "{{ shared_dir }}" + #- name: openwind | Update/checkout Nansat # git: repo=https://github.com/nansencenter/nansat # dest="{{ dev_sources_dir }}/nansat/"