From 0ab4b0d8c02d5fac1e8594f24c481317e27e609c Mon Sep 17 00:00:00 2001 From: koralowiec Date: Fri, 1 Mar 2024 15:36:05 +0100 Subject: [PATCH] feat: add option to set custom jupyter and vscode conf --- defaults/main.yml | 19 +++++++++++++++++++ tasks/configure.yml | 20 ++++++++++++++++++++ templates/etc/rstudio/jupyter.conf.j2 | 6 ++++++ templates/etc/rstudio/vscode.conf.j2 | 6 ++++++ 4 files changed, 51 insertions(+) create mode 100644 templates/etc/rstudio/jupyter.conf.j2 create mode 100644 templates/etc/rstudio/vscode.conf.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 43a1740..93c4750 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -233,3 +233,22 @@ rstudio_workbench_sssd_install: false # rstudio_workbench_repos_config: # CRAN: "https://example.com/cran/__linux__/focal/latest" # Internal: "https://example.com/internal-git/latest" + +############################################################ +# /etc/rstudio/vscode.conf +############################################################ + +# rstudio_workbench_vscode_config: +# enabled: "1" +# exe: "/usr/lib/rstudio-server/bin/code-server/bin/code-server" +# args: "--host=0.0.0.0" + +############################################################ +# /etc/rstudio/jupyter.conf +############################################################ + +# rstudio_workbench_jupyter_config: +# jupyter-exe: "/usr/local/bin/jupyter" +# notebooks-enabled: "1" +# labs-enabled: "1" +# session-cull-minutes: "0" diff --git a/tasks/configure.yml b/tasks/configure.yml index dc9c224..d77eb96 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -156,6 +156,26 @@ when: - rstudio_workbench_repos_config is defined +- name: Configure | create (vscode.conf) file + ansible.builtin.template: + src: etc/rstudio/vscode.conf.j2 + dest: /etc/rstudio/vscode.conf + owner: root + group: root + mode: 0644 + when: + - rstudio_workbench_vscode_config is defined + +- name: Configure | create (jupyter.conf) file + ansible.builtin.template: + src: etc/rstudio/jupyter.conf.j2 + dest: /etc/rstudio/jupyter.conf + owner: root + group: root + mode: 0644 + when: + - rstudio_workbench_jupyter_config is defined + - name: Configure | license activation (offline) notify: Restart rstudio-workbench when: rstudio_workbench_license_offline_key_b64_encoded | d() diff --git a/templates/etc/rstudio/jupyter.conf.j2 b/templates/etc/rstudio/jupyter.conf.j2 new file mode 100644 index 0000000..ad2b491 --- /dev/null +++ b/templates/etc/rstudio/jupyter.conf.j2 @@ -0,0 +1,6 @@ +{{ ansible_managed | comment }} + +{% if rstudio_workbench_jupyter_config is defined %} +{% from "macros/ini_encode_macro.j2" import ini_encode with context -%} +{{ ini_encode(rstudio_workbench_jupyter_config) }} +{% endif %} diff --git a/templates/etc/rstudio/vscode.conf.j2 b/templates/etc/rstudio/vscode.conf.j2 new file mode 100644 index 0000000..7968a86 --- /dev/null +++ b/templates/etc/rstudio/vscode.conf.j2 @@ -0,0 +1,6 @@ +{{ ansible_managed | comment }} + +{% if rstudio_workbench_vscode_config is defined %} +{% from "macros/ini_encode_macro.j2" import ini_encode with context -%} +{{ ini_encode(rstudio_workbench_vscode_config) }} +{% endif %}