library/roles/R: Set the default CRAN mirror site.

This commit is contained in:
Andrea Dell'Amico 2016-01-21 11:48:03 +01:00
parent ab0915ab32
commit 209b9892fb
3 changed files with 36 additions and 0 deletions

View File

@ -11,6 +11,7 @@
# Set to present if you want install from CRAN
r_install_cran_repo: absent
#r_cran_mirror_site: http://cran.rstudio.com
r_cran_set_default_mirror: True
r_cran_mirror_site: http://cran.mirror.garr.it/mirrors/CRAN/
r_base_specific_version: False
r_base_pkg_version: 2.14.1

View File

@ -32,6 +32,11 @@
when: r_plugins_from_deb
tags: [ 'r_software', 'r_pkg' ]
- 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
tags: [ 'r_software', 'r_profile', 'r_pkg' ]
- name: Install some packages needed by R plugins when installed from source, if needed
apt: pkg={{ item }} state={{ r_packages_state }} update_cache=yes force=yes
with_items: r_distribution_required_packages

View File

@ -0,0 +1,30 @@
## Emacs please make this -*- R -*-
## empty Rprofile.site for R on Debian
##
## Copyright (C) 2008 Dirk Eddelbuettel and GPL'ed
##
## see help(Startup) for documentation on ~/.Rprofile and Rprofile.site
#
# NOTE: managed by ansible
#
# ## Example of .Rprofile
# options(width=65, digits=5)
# options(show.signif.stars=FALSE)
# setHook(packageEvent("grDevices", "onLoad"),
# function(...) grDevices::ps.options(horizontal=FALSE))
# set.seed(1234)
# .First <- function() cat("\n Welcome to R!\n\n")
# .Last <- function() cat("\n Goodbye!\n\n")
# ## Example of Rprofile.site
# local({
# # add MASS to the default packages, set a CRAN mirror
# old <- getOption("defaultPackages"); r <- getOption("repos")
# r["CRAN"] <- "http://my.local.cran"
# options(defaultPackages = c(old, "MASS"), repos = r)
#})
local({r <- getOption("repos")
r["CRAN"] <- "{{ r_cran_mirror_site }}"
options(repos=r)
})