generated from Appsilon/ansible-role-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from Appsilon/feat/jupyter-installation
[WIP] feat: add Jupyter installation
- Loading branch information
Showing
13 changed files
with
139 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
become: true | ||
pre_tasks: | ||
- name: Include main vars | ||
include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml" | ||
- name: Include jupyter-system vars | ||
include_vars: "{{ playbook_dir }}/../../tests/vars/jupyter-system.yml" | ||
roles: | ||
- "{{ playbook_dir }}/../../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
driver: | ||
name: docker | ||
platforms: | ||
- name: instance-jupyter-system | ||
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2004}-ansible:latest" | ||
command: ${MOLECULE_DOCKER_COMMAND:-""} | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true | ||
cgroupns_mode: host | ||
pre_build_image: true | ||
platform: linux/amd64 | ||
provisioner: | ||
name: ansible | ||
playbooks: | ||
prepare: prepare.yml | ||
converge: converge.yml | ||
verify: verify.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- name: Prepare | ||
hosts: all | ||
become: true | ||
tasks: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
become: true | ||
pre_tasks: | ||
- name: Include vars | ||
ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml" | ||
tasks: | ||
- name: Include tasks | ||
ansible.builtin.include_tasks: "{{ playbook_dir }}/../../tests/tasks/post.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
- name: Install Python | Combine Jupyter packages | ||
ansible.builtin.set_fact: | ||
python_jupyter_packages: "{{ python_jupyter_packages + python_jupyter_workbench_packages }}" | ||
when: python_jupyter_workbench | ||
|
||
- name: Install Python | Install Jupyter packages (virtualenv method) | ||
ansible.builtin.pip: | ||
name: "{{ python_jupyter_packages }}" | ||
virtualenv_command: "/opt/python/{{ python_jupyter_python_version }}/bin/python -m venv" | ||
virtualenv: "{{ python_jupyter_virtualenv_path }}" | ||
when: python_jupyter_install_method == "virtualenv" | ||
|
||
- name: Install Python | Install Jupyter packages (system method) | ||
ansible.builtin.pip: | ||
name: "{{ python_jupyter_packages }}" | ||
executable: pip3 | ||
when: python_jupyter_install_method == "system" | ||
|
||
- name: Install Python | Set path to jupyter-nbextension | ||
ansible.builtin.set_fact: | ||
jupyter_nbextension_path: "{{ (python_jupyter_install_method == 'virtualenv') | ternary(python_jupyter_virtualenv_path + '/bin/', '') }}jupyter-nbextension" | ||
jupyter_etc_nbconfig: "{{ (python_jupyter_install_method == 'virtualenv') | ternary('/opt/jupyter', '/usr') }}/etc/jupyter/nbconfig" | ||
|
||
- name: Install Python | Install Workbench's Jupyter plugin | ||
ansible.builtin.command: | | ||
{{ jupyter_nbextension_path }} install --sys-prefix --py rsp_jupyter | ||
register: command_result | ||
# jupyter-nbextension returns the needed information in stderr | ||
changed_when: "'Copying:' in command_result.stderr" | ||
when: python_jupyter_workbench | ||
|
||
- name: Install Python | Enable Workbench's Jupyter plugin | ||
ansible.builtin.shell: | | ||
grep 'rsp_jupyter/index' {{ jupyter_etc_nbconfig }}/notebook.json || echo "File doesn't exist yet" | ||
{{ jupyter_nbextension_path }} enable --sys-prefix --py rsp_jupyter | ||
register: command_result | ||
changed_when: "'\"rsp_jupyter/index\": true' not in command_result.stdout" | ||
when: python_jupyter_workbench |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# vars file | ||
--- | ||
python_jupyter_install_method: system |