forked from ISTI-ansible-roles/ansible-roles
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.
This commit is contained in:
parent
bf9c783f9b
commit
9d36440c95
|
@ -34,10 +34,10 @@
|
||||||
|
|
||||||
- name: Configure the default CRAN mirror
|
- name: Configure the default CRAN mirror
|
||||||
template: src=Rprofile.site.j2 dest=/etc/R/Rprofile.site owner=root group=root mode=0444
|
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' ]
|
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
|
apt: pkg={{ item }} state={{ r_packages_state }} update_cache=yes force=yes
|
||||||
with_items: r_distribution_required_packages
|
with_items: r_distribution_required_packages
|
||||||
when: r_needs_additional_distro_pkgs
|
when: r_needs_additional_distro_pkgs
|
||||||
|
@ -48,10 +48,20 @@
|
||||||
when: r_plugins_from_sources is defined
|
when: r_plugins_from_sources is defined
|
||||||
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ]
|
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
|
- name: Get the R packages sources that need to be installed
|
||||||
get_url: url={{ item.url }} dest={{ r_source_plugins_dest_dir }}
|
get_url: url={{ item.url }} dest={{ r_source_plugins_dest_dir }}
|
||||||
with_items: r_plugins_from_sources
|
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' ]
|
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ]
|
||||||
|
|
||||||
- name: Install R packages from the cran sources, specific versions
|
- name: Install R packages from the cran sources, specific versions
|
||||||
|
@ -75,16 +85,6 @@
|
||||||
when: r_plugins_install_specific_source
|
when: r_plugins_install_specific_source
|
||||||
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ]
|
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
|
- name: Install R packages from github
|
||||||
command: >
|
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'); }"
|
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'); }"
|
||||||
|
|
Loading…
Reference in New Issue