From 37cd0bad13ee3272e5cf6ffa92cb729428981639 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Thu, 5 Dec 2024 08:55:01 +0100 Subject: [PATCH 1/5] feat(RStudio):added rspm --- rstudio/rstudio.yml | 91 ++++++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 39 deletions(-) diff --git a/rstudio/rstudio.yml b/rstudio/rstudio.yml index 0f08e86..ac6d176 100644 --- a/rstudio/rstudio.yml +++ b/rstudio/rstudio.yml @@ -2,67 +2,80 @@ - name: PRE_TASK Update apt cache become: true ansible.builtin.apt: - upgrade: true - update_cache: true - autoremove: true - autoclean: true - + upgrade: true + update_cache: true + autoremove: true + autoclean: true - name: Pip ansible.builtin.apt: - name: python3-pip - state: latest + name: python3-pip + state: latest - name: Setup password for default user become: true ansible.builtin.user: - name: "{{ rstudio_vars.default_user }}" - password: "{{ rstudio_vars.default_password | password_hash('sha512') }}" - update_password: always - password_lock: false - + name: "{{ rstudio_vars.default_user }}" + password: "{{ rstudio_vars.default_password | password_hash('sha512') }}" + update_password: always + password_lock: false - name: Install R role include_role: - name: oefenweb.latest_r + name: oefenweb.latest_r when: not rstudio_vars.create_only_backend - name: Install rstudio-server role include_role: - name: oefenweb.rstudio_server + name: oefenweb.rstudio_server vars: - rstudio_install: [r-base] - rstudio_server_version: "{{ rstudio_vars.RSTUDIO_VERSION | replace('v', '') | replace('+', '-') }}" + rstudio_install: [r-base] + rstudio_server_version: "{{ rstudio_vars.RSTUDIO_VERSION | replace('v', '') | replace('+', '-') }}" + r_packages: + - name: remotes + - name: cran4linux/rspm + type: github + when: not rstudio_vars.create_only_backend + +- name: Configure R profile + become: true + become_user: ubuntu + blockinfile: + path: /home/{{ rstudio_vars.default_user }}/.Rprofile + marker: "# {mark} ANSIBLE MANAGED BLOCK" + block: | + suppressMessages(rspm::enable()) when: not rstudio_vars.create_only_backend + - name: Install essential system packages ansible.builtin.apt: - name: - - build-essential - - libcurl4-openssl-dev - - libssl-dev - - zlib1g-dev - - libpng-dev - - libjpeg-dev - - libtiff-dev - - libfreetype6-dev - - libfontconfig1-dev - - libmysqlclient-dev - - libsqlite3-dev - - libpq-dev - - libfribidi-dev - - libharfbuzz-dev - - libxml2-dev - - cmake - state: present + name: + - build-essential + - libcurl4-openssl-dev + - libssl-dev + - zlib1g-dev + - libpng-dev + - libjpeg-dev + - libtiff-dev + - libfreetype6-dev + - libfontconfig1-dev + - libmysqlclient-dev + - libsqlite3-dev + - libpq-dev + - libfribidi-dev + - libharfbuzz-dev + - libxml2-dev + - cmake + state: present become: true - name: Copy session file if also installing rstudio ansible.builtin.copy: - content: session-timeout-minutes=180 - dest: "{{ rstudio_vars.RSESSION_FILE_PATH }}" - mode: "0644" - owner: root - group: root + content: session-timeout-minutes=180 + dest: "{{ rstudio_vars.RSESSION_FILE_PATH }}" + mode: "0644" + owner: root + group: root when: not rstudio_vars.create_only_backend - name: Flush rstudio handlers From e97ab3a028f2d9d61235e9ffa1b21595602c4278 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Thu, 5 Dec 2024 08:57:59 +0100 Subject: [PATCH 2/5] feat(RStudio):added rspm --- rstudio/rstudio.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/rstudio/rstudio.yml b/rstudio/rstudio.yml index ac6d176..c372332 100644 --- a/rstudio/rstudio.yml +++ b/rstudio/rstudio.yml @@ -1,17 +1,4 @@ --- -- name: PRE_TASK Update apt cache - become: true - ansible.builtin.apt: - upgrade: true - update_cache: true - autoremove: true - autoclean: true - -- name: Pip - ansible.builtin.apt: - name: python3-pip - state: latest - - name: Setup password for default user become: true ansible.builtin.user: @@ -20,6 +7,20 @@ update_password: always password_lock: false +- name: Update package index + become: true + apt: + update_cache: true + when: not rstudio_vars.create_only_backend + +- name: Install apt-file + become: true + apt: + name: apt-file + state: present + when: not rstudio_vars.create_only_backend + + - name: Install R role include_role: name: oefenweb.latest_r From 1fbc90ac36b8352fd86d77d949d57a97c9555725 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Thu, 5 Dec 2024 09:12:23 +0100 Subject: [PATCH 3/5] fixed playbook --- rstudio/rstudio.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rstudio/rstudio.yml b/rstudio/rstudio.yml index c372332..122afc6 100644 --- a/rstudio/rstudio.yml +++ b/rstudio/rstudio.yml @@ -20,7 +20,6 @@ state: present when: not rstudio_vars.create_only_backend - - name: Install R role include_role: name: oefenweb.latest_r @@ -38,6 +37,12 @@ type: github when: not rstudio_vars.create_only_backend +- name: Ensure .Rprofile file exists + become: true + file: + path: /home/{{ rstudio_vars.default_user }}/.Rprofile + state: touch + when: not rstudio_vars.create_only_backend - name: Configure R profile become: true become_user: ubuntu From 3c32dfc4b8ea363179af5d92459a9a8ae098d705 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Thu, 5 Dec 2024 09:47:06 +0100 Subject: [PATCH 4/5] fixed package installation --- rstudio/rstudio.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rstudio/rstudio.yml b/rstudio/rstudio.yml index 122afc6..6432cb0 100644 --- a/rstudio/rstudio.yml +++ b/rstudio/rstudio.yml @@ -23,6 +23,11 @@ - name: Install R role include_role: name: oefenweb.latest_r + vars: + r_packages: + - name: remotes + - name: cran4linux/rspm + type: github when: not rstudio_vars.create_only_backend - name: Install rstudio-server role @@ -31,16 +36,12 @@ vars: rstudio_install: [r-base] rstudio_server_version: "{{ rstudio_vars.RSTUDIO_VERSION | replace('v', '') | replace('+', '-') }}" - r_packages: - - name: remotes - - name: cran4linux/rspm - type: github when: not rstudio_vars.create_only_backend - name: Ensure .Rprofile file exists become: true file: - path: /home/{{ rstudio_vars.default_user }}/.Rprofile + path: /home/{{ rstudio_vars.default_user }}git/.Rprofile state: touch when: not rstudio_vars.create_only_backend - name: Configure R profile From 05831930ee2f06ebb79fbbeff892e5aad19c5fa7 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Thu, 5 Dec 2024 09:56:32 +0100 Subject: [PATCH 5/5] fixed package installation --- rstudio/rstudio.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rstudio/rstudio.yml b/rstudio/rstudio.yml index 6432cb0..bccfc9f 100644 --- a/rstudio/rstudio.yml +++ b/rstudio/rstudio.yml @@ -41,7 +41,7 @@ - name: Ensure .Rprofile file exists become: true file: - path: /home/{{ rstudio_vars.default_user }}git/.Rprofile + path: /home/{{ rstudio_vars.default_user }}/.Rprofile state: touch when: not rstudio_vars.create_only_backend - name: Configure R profile