diff --git a/R/defaults/main.yml b/R/defaults/main.yml index 9e37be2e..b8b97f66 100644 --- a/R/defaults/main.yml +++ b/R/defaults/main.yml @@ -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 diff --git a/R/tasks/main.yml b/R/tasks/main.yml index 6dd47304..0e754edd 100644 --- a/R/tasks/main.yml +++ b/R/tasks/main.yml @@ -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 diff --git a/R/templates/Rprofiles.site.j2 b/R/templates/Rprofiles.site.j2 new file mode 100644 index 00000000..660168d7 --- /dev/null +++ b/R/templates/Rprofiles.site.j2 @@ -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) +})