From 9d36440c951bfb9b7ae591c9b7d29590eda1a628 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 3 Feb 2016 16:40:08 +0100 Subject: [PATCH] d4science-ghn-cluster/group_vars/rstudio: New rstudio group. Only used to deploy R right now. library/roles/R/tasks/main.yml: Another attempt to fix the packages installation workflow. --- R/tasks/main.yml | 26 +++++++++---------- .../{Rprofiles.site.j2 => Rprofile.site.j2} | 0 2 files changed, 13 insertions(+), 13 deletions(-) rename R/templates/{Rprofiles.site.j2 => Rprofile.site.j2} (100%) diff --git a/R/tasks/main.yml b/R/tasks/main.yml index 0e754ed..bd74f03 100644 --- a/R/tasks/main.yml +++ b/R/tasks/main.yml @@ -34,10 +34,10 @@ - name: Configure the default CRAN mirror template: src=Rprofile.site.j2 dest=/etc/R/Rprofile.site owner=root group=root mode=0444 - when: r_install_cran_repo + when: r_install_cran_repo == 'present' tags: [ 'r_software', 'r_profile', 'r_pkg' ] -- name: Install some packages needed by R plugins when installed from source, if needed +- name: Install some packages needed by R packages when installed from source apt: pkg={{ item }} state={{ r_packages_state }} update_cache=yes force=yes with_items: r_distribution_required_packages when: r_needs_additional_distro_pkgs @@ -48,10 +48,20 @@ when: r_plugins_from_sources is defined tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ] +- name: Install R packages from the cran sources repo, latest available version + command: > + Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item }}', repos=c('{{ r_cran_mirror_site }}/')); print('Added'); } else { print('Already installed'); }" + register: install_plugins_result + failed_when: "install_plugins_result.rc != 0 or 'had non-zero exit status' in install_plugins_result.stderr" + changed_when: "'Added' in install_plugins_result.stdout" + with_items: r_plugins_list_to_install + when: r_plugins_install_latest_source + tags: [ 'r_software', 'r_pkg', 'r_plugins' ] + - name: Get the R packages sources that need to be installed get_url: url={{ item.url }} dest={{ r_source_plugins_dest_dir }} with_items: r_plugins_from_sources - when: r_plugins_from_sources is defined + when: r_plugins_install_specific_source tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ] - name: Install R packages from the cran sources, specific versions @@ -75,16 +85,6 @@ when: r_plugins_install_specific_source tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ] -- name: Install R packages from the cran sources repo, latest version - command: > - Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item }}', repos=c('{{ r_cran_mirror_site }}/')); print('Added'); } else { print('Already installed'); }" - register: install_plugins_result - failed_when: "install_plugins_result.rc != 0 or 'had non-zero exit status' in install_plugins_result.stderr" - changed_when: "'Added' in install_plugins_result.stdout" - with_items: r_plugins_list_to_install - when: r_plugins_install_latest_source - tags: [ 'r_software', 'r_pkg', 'r_plugins' ] - - name: Install R packages from github command: > Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.plugin_name }}' %in% installed.packages()[,'Package'])) { require(devtools); require(methods) ; options(repos='{{ r_cran_mirror_site }}/') ; install_github('{{ item.plugin_name }}', '{{ item.github_user }}'); print('Added'); } else { print('Already Installed'); }" diff --git a/R/templates/Rprofiles.site.j2 b/R/templates/Rprofile.site.j2 similarity index 100% rename from R/templates/Rprofiles.site.j2 rename to R/templates/Rprofile.site.j2