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:


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



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({})) }}'


    - role: keyring
      tags: [ 'role::keyring', 'skip::keyring', 'role::cran' ]
        - '{{ cran__keyring__dependent_apt_keys }}'

    - role: apt_preferences
      tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
        - '{{ 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' ]