Ansible role that installs R itself, R packages (from CRAN, archived and remote repos) and associated tools.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.6 KiB

---
# NOTE:
# tasks in this role must be able to run from both workstation and luxor playbooks
# because mounts-remote role depends on this role
# Most tasks are only relevant if we are on luxor
# Set the R_bin_path using the R_version
- name: "Set the R bin path"
set_fact:
R_bin_path: "{{ R_directory }}/{{ R_version }}/bin"
# Import tasks to compile and build R
- name: Compile and build R
import_tasks: compile.yml
when:
- (install_R | bool) or (update_R | bool)
- "'luxor' in group_names"
- name: Configure R environment files
import_tasks: config.yml
when: "'luxor' in group_names"
- name: Install dependencies that are required for our R packages
import_tasks: dependencies.yml
when: "'luxor' in group_names or 'rstudio_servers' in group_names or 'workstation' in group_names"
# We want to avoid running install-packages.yml unnecessarily, since
# it is very slow to complete even when the packages are already installed.
# We therefore only run it when requested by install_R or reinstall_packages_R
# note that packages will need to be installed anew if you have updated R itself
- name: Install R packages
import_tasks: install-packages.yml
when:
- (install_R | bool) or (update_R | bool) or (reinstall_packages_R | bool)
- "'luxor' in group_names"
- name: Update R packages
import_tasks: update-packages.yml
when:
- update_packages_R | bool
- "'luxor' in group_names"
- name: Install/update Hugo and PhantomJS
import_tasks: hugo.yml
when:
- (update_packages_R | bool) or (install_R | bool) or (update_R | bool)
- "'luxor' in group_names"
# Due to the role mounts-remote depending on this role, I expect
# this task to run on many different hosts, including workstations, dns_servers, luxor, damietta, etc.
# Only luxor, luxor's LXD containers and workstations are expected to have /opt/R mounted and thus require this task
# NOTE: when setting up a workstation from scratch, this task causes a warning
# "Cannot set fs attributes on a non-existent symlink target. follow should be set to False to avoid this" which can
# be safely ignored (it's resolved by subsequent tasks in this role).
- name: Symlink R executables to /usr/local/bin/
ansible.builtin.file:
src: "{{ R_bin_path }}/{{ item.src }}"
dest: "/usr/local/bin/{{ item.dest }}"
state: link
force: yes # because this task may run before /opt/R has been mounted
when: "'luxor' in group_names or 'rstudio_servers' in group_names or 'workstation' in group_names"
with_items:
- { src: R, dest: R }
- { src: Rscript, dest: Rscript }
- { src: "hugo/{{ hugo_version }}/hugo", dest: hugo }
- { src: phantomjs, dest: phantomjs }