diff --git a/defaults/main.yml b/defaults/main.yml index 32468db..bbd04a0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,6 +11,9 @@ # # Set to True if you want install from the CRAN deb repository r_install_cran_repo: False +# This si the CRAN main repository, that contains the r-base-* packages +r_cran_ubuntu_repo_key: 'E298A3A825C0D65DFD57CBB651716619E084DAB9' +r_cran_ubuntu_repo: 'deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/' # Use 'marutter/c2d4u3.5' for R 3.6 r_cran_ubuntu_packages_ppa_trusty: 'ppa:marutter/c2d4u' # 4.1, Ubuntu 18.04+ diff --git a/tasks/r-installation-deb.yml b/tasks/r-installation-deb.yml index e87a2b7..7d779c4 100644 --- a/tasks/r-installation-deb.yml +++ b/tasks/r-installation-deb.yml @@ -19,6 +19,17 @@ tags: [ 'r_software', 'r_repo' ] - block: + - name: Install the CRAN main R repository key + apt_key: + keyserver: 'keyserver.ubuntu.com' + id: '{{ r_cran_ubuntu_repo_key }}' + + - name: Install the CRAN main R repository + apt_repository: + repo: '{{ r_cran_ubuntu_repo }}' + state: present + update_cache: yes + - name: Add the CRAN repository (Ubuntu Bionic PPA) apt_repository: repo: '{{ r_cran_ubuntu_packages_ppa }}' @@ -38,12 +49,18 @@ tags: [ 'r_software', 'r_repo' ] - block: - - name: Remove the CRAN repository + - name: Remove the CRAN repositores apt_repository: repo: '{{ r_cran_ubuntu_packages_ppa }}' state: absent update_cache: yes + - name: Remove the CRAN main repository + apt_repository: + repo: '{{ r_cran_ubuntu_repo }}' + state: absent + update_cache: yes + when: not r_install_cran_repo tags: [ 'r_software', 'r_repo' ]