Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make use of other keyring #60

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -1,12 +1,12 @@
# tasks file
---
- name: packages | copy r scripts

Check warning on line 3 in tasks/packages.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.template:
src: "{{ item.src }}"
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 All @@ -23,12 +23,12 @@
tags:
- r-packages-copy-r-scripts

- name: installed packages

Check warning on line 26 in tasks/packages.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
when: r_list_packages_once | bool
tags:
- r-packages-list-installed
block:
- name: packages | list installed packages

Check warning on line 31 in tasks/packages.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.command: >
R-list-installed-packages {{ r_packages_lib }}
environment: "{{ r_environment }}"
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
Loading