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. 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 }}'

    - role: java
      tags: [ 'role::java', 'skip::java' ]
      java__install_jdk: True
      when: cran__java_integration | bool

    - role: cran
      tags: [ 'role::cran', 'skip::cran' ]