DEBOPS.CRAN(5)

NAME
debops.cran - Manage the Comprehensive R Archive Network packages

SYNOPSIS

debops service/cran [--limit group,host,...] [--diff] [--check] [--tags tag1,tag2,...] [--skip-tags tag1,tag2,...] [<ansible-playbook options>] ...

DESCRIPTION

The Comprehensive R Archive Network <https://cran.r-project.org/> (CRAN) is a repository of precompiled packages for the R statistical programming language environment. This role can be used to enable the upstream CRAN APT repositories and install R packages, both via APT and via R itself.

GETTING STARTED

  Default configuration

Contrary to usual DebOps practice, upstream APT repositories configured by the debops.cran role are enabled by default, due to incompatibilities between Debian Stable package versions and packages provided by CRAN <https://cran.r-project.org/bin/linux/debian/#debian-stretch-stable>. The users are still able to disable upstream APT repositories and use the R APT packages provided by their OS release if they wish, before configuring the R environment.

  Example inventory

To configure the R environment on a host, it needs to be included in the [debops_service_cran] Ansible inventory group:

[debops_service_cran]
hostname

The role can automatically enable Java support in R, if Java environment installed by the debops.java Ansible role is detected. To do that, add the host to the [debops_service_java] Ansible inventory group:

[debops_service_java]
hostname
[debops_service_cran]
hostname

If you already configured R and you want to enable Java support, remove the /etc/ansible/facts.d/cran.fact file from the remote host; this will tell the role to configure Java support in the R environment on the next Ansible run.

  Example playbook

If you are using this role without DebOps, here's an example Ansible playbook that uses the debops.cran role:

---
- name: Manage the Comprehensive R Archive Network packages
  collections: [ 'debops.debops', 'debops.roles01',
                 'debops.roles02', 'debops.roles03' ]
  hosts: [ 'debops_service_cran' ]
  become: True
  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'
  roles:
    - role: keyring
      tags: [ 'role::keyring', 'skip::keyring', 'role::cran' ]
      keyring__dependent_apt_keys:
        - '{{ cran__keyring__dependent_apt_keys }}'
    - role: apt_preferences
      tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
      apt_preferences__dependent_list:
        - '{{ cran__apt_preferences__dependent_list }}'
        - '{{ java__apt_preferences__dependent_list
              if cran__java_integration|bool else [] }}'
    - role: java
      tags: [ 'role::java', 'skip::java' ]
      java__install_jdk: True
      when: cran__java_integration|bool
    - role: cran
      tags: [ 'role::cran', 'skip::cran' ]

DEFAULT VARIABLE DETAILS

Some of debops.cran default variables have more extensive configuration than simple strings or lists, here you can find documentation and examples for them.

  cran__r_packages

The cran__*_r_packages variables define what R packages will be installed by Ansible system-wide, in the /usr/local/lib/R/site-library/ directory. Each variable contains a list of entries, an entry can be a simple string with the package name, which will be installed if available. Alternatively an entry can be a YAML dictionary with specific parameters:

name
    Required. Name of the R package to install or remove.

state
    Optional. If not specified or present, the specific R package will be installed. If absent, the specific R package will be removed.

repo
    Optional. URL of the repository with the R packages to use. If not specified, the value of the cran__upstream_mirror variable will be used by default.

  Examples

Install selected R packages system-wide:

cran__r_packages:
  - 'Rcpp'
  - 'ggplot2'
  - name: 'plyr'
    state: 'present'

AUTHOR
Maciej Delmanowski

COPYRIGHT
2014-2022, Maciej Delmanowski, Nick Janetakis, Robin Schneider and others