user3313834
user3313834

Reputation: 7827

ansible r-base 3.2 install on debian

To get r-base version 3.2 on debian 8 "Jessie" I use the documentation:

https://cran.r-project.org/bin/linux/debian/#debian-jessie-stable and install latest version of R 3.2.1 (World-Famous Astronaut) on Linux Mint 17.1 (MATE)

In short we add

deb http://<favourite-cran-mirror>/bin/linux/debian jessie-cran3/

to the file /etc/apt/sources.list and eventually sign it with:

apt-key adv --keyserver keys.gnupg.net --recv-key 381BA480

What is the correct way to do this in ansible ?

Upvotes: 2

Views: 358

Answers (1)

chilladx
chilladx

Reputation: 2207

This should be straightforward using apt-key and apt-repository modules as Frank suggested:

- name: Add the APT key for official R repository
  apt_key: id="381BA480" keyserver="pgp.mit.edu" state=present

- name: Ensure APT official R repository
  apt_repository: repo="deb http://mirror.ibcp.fr/pub/CRAN/bin/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release|lower }}-cran3/"

This should create the file /etc/apt/sources.list.d/mirror_ibcp_fr_pub_CRAN_bin_linux_debian.list with the following content:

deb http://mirror.ibcp.fr/pub/CRAN/bin/linux/debian jessie-cran3/

You can now use apt module:

- name: Install the R packages
  apt: name=r-base install_recommends="yes" state=present

Note that obviously, the <favourite-cran-mirror> or keyserver can be adjusted as you wish.

Upvotes: 1

Related Questions