Skip to content

Commit

Permalink
Make use of other keyring (#60)
Browse files Browse the repository at this point in the history
* Make use of other keyring

* Cleanup

* Cleanup
  • Loading branch information
tersmitten authored Dec 10, 2024
1 parent ee35130 commit 414c0b7
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Set up the latest version of R in Ubuntu systems.
* `r_cran_mirror`: [default: `https://cran.rstudio.com/`]: Your favorite [CRAN mirror](https://cran.r-project.org/mirrors.html)
* `r_bioclite_url`: [default: `https://bioconductor.org/biocLite.R`]: The `biocLite.R` script URL for [Bioconductor](https://bioconductor.org/) installs

* `r_install_dev`: [default: `false`]: Whether or not install the `r-base-dev` package
* `r_install_dev`: [default: `false`]: Whether install the `r-base-dev` package
* `r_install`: [default: `['littler']`]: Additional (apt) packages to install (e.g. `r-recommended`)

* `r_packages_lib`: [default: `/usr/local/lib/R/site-library`]: The (default) library directory to install packages to
Expand All @@ -33,7 +33,7 @@ Set up the latest version of R in Ubuntu systems.
* `r_packages.{n}.lib`: [optional, default: `r_packages_lib`]: The library directory to install the package to
* `r_packages.{n}.repos`: [optional, default: `r_packages_repos`]: The URL to install the package from

* `r_environment`: [default: `{}`]: Environment variables to set (during the install, update or delete packages tasks)
* `r_environment`: [default: `{}`]: Environment variables to set (during the installation, update or delete packages tasks)

* `r_scripts_install_path:`: [default: `/usr/local/bin`]: The path where to install the R script used to install, update and delete R package
* `r_scripts_install_owner`: [default: `root`]: The owner of the R script to install, update and delete R package
Expand Down
2 changes: 1 addition & 1 deletion tasks/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
dest: "{{ r_scripts_install_path }}/{{ item.dest }}"
owner: "{{ r_scripts_install_owner }}"
group: "{{ r_scripts_install_group }}"
mode: 0755
mode: '0755'
with_items:
- src: R-list-installed-packages.j2
dest: R-list-installed-packages
Expand Down
25 changes: 18 additions & 7 deletions tasks/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,31 @@
tags:
- r-repository-install-dependencies

- name: repository | add public key
- name: repository | (keyrings) directory | create
ansible.builtin.file:
path: "{{ r_keyring_dst | dirname }}"
state: directory
owner: root
group: root
mode: '0755'
tags:
- r-repository-keyrings-directory-create

- name: repository | (keyring) file | download
ansible.builtin.apt_key:
id: E298A3A825C0D65DFD57CBB651716619E084DAB9
id: "{{ r_keyring_id }}"
keyserver: "{{ apt_key_keyserver | default('keyserver.ubuntu.com') }}"
keyring: "{{ r_keyring_dst }}"
state: present
tags:
- r-repository-public-key
- r-repository-keyring-file-download

- name: repository | add cran-r
- name: repository | add
ansible.builtin.apt_repository:
repo: "{{ item.type }} {{ item.url }}"
state: present
state: "{{ item.state | default('present') }}"
update_cache: true
mode: 0644
with_items: "{{ r_repository }}"
mode: '0644'
with_items: "{{ r_repositories }}"
tags:
- r-repository-add
3 changes: 2 additions & 1 deletion tests/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# test file
---
- hosts: localhost
- name: converge
hosts: localhost
connection: local
become: true
roles:
Expand Down
3 changes: 2 additions & 1 deletion tests/vagrant.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# test file
---
- hosts: all
- name: converge
hosts: all
remote_user: vagrant
become: true
roles:
Expand Down
8 changes: 6 additions & 2 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# vars file
---
r_keyring_id: E298A3A825C0D65DFD57CBB651716619E084DAB9
r_keyring_dst: /usr/share/keyrings/cran-r.gpg
r_repository_suffix: "{{ '-cran' + r_version if r_version is version('35', '>=') else '' }}"
r_repository:
r_repositories:
- type: "deb [signed-by={{ r_keyring_dst }}]"
url: "{{ r_cran_mirror }}/bin/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }}{{ r_repository_suffix }}/"
- type: deb
url: "{{ r_cran_mirror }}/bin/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }}{{ r_repository_suffix }}/"
state: absent

r_dependencies_pre:
- software-properties-common
- dirmngr
- gpg-agent
- apt-transport-https

r_dependencies:
Expand Down

0 comments on commit 414c0b7

Please sign in to comment.