在 debian 上安装 ansible r-base 3.2

ansible r-base 3.2 install on debian

要在 debian 8 上获得 r-base 版本 3.2 "Jessie" 我使用文档:

https://cran.r-project.org/bin/linux/debian/#debian-jessie-stable and

简而言之,我们添加

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

添加到文件 /etc/apt/sources.list 并最终用以下方式签名:

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

ansible 中执行此操作的正确方法是什么?

按照 Frank 的建议,使用 apt-keyapt-repository 模块应该很简单:

- 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/"

这应该创建包含以下内容的文件 /etc/apt/sources.list.d/mirror_ibcp_fr_pub_CRAN_bin_linux_debian.list

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

您现在可以使用 apt 模块:

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

请注意,显然,<favourite-cran-mirror> 或密钥服务器可以根据需要进行调整。