Skip to content

Commit

Permalink
add a default var to set R script path for install (#52)
Browse files Browse the repository at this point in the history
* add a default var to set R script path for install

* add the R script path variable in the doc

* add r scripts path in command task

* remove owner and group for file template as we may want to run it as other user than root

* add owner and group variable for R script install

* fix bad line on R script command

* use root as default user and group

* add new owner and group var to README
  • Loading branch information
FanchTheSystem authored May 3, 2021
1 parent 412e56d commit 0641195
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ Set up the latest version of R in Ubuntu systems.

* `r_environment`: [default: `{}`]: Environment variables to set (during the install, 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
* `r_scripts_install_group`: [default: `root`]: The group of the R script to install, update and delete R package

## Dependencies

None
Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ r_packages_repos: "{{ r_cran_mirror }}"
r_packages_lib: /usr/local/lib/R/site-library
r_packages: []
r_environment: {}

r_scripts_install_path: /usr/local/bin
r_scripts_install_owner: root
r_scripts_install_group: root
14 changes: 7 additions & 7 deletions tasks/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
---
- name: packages | copy r scripts
template:
src: "usr/local/bin/{{ item.src }}"
dest: "/usr/local/bin/{{ item.dest }}"
owner: root
group: root
src: "{{ item.src }}"
dest: "{{ r_scripts_install_path }}/{{ item.dest }}"
owner: "{{ r_scripts_install_owner }}"
group: "{{ r_scripts_install_group }}"
mode: 0755
with_items:
- src: R-install-package.j2
Expand All @@ -23,7 +23,7 @@

- name: packages | install
command: >
R-install-package
{{ r_scripts_install_path }}/R-install-package
{{ item.name }}
{{ item.type | default(r_packages_type) }}
{{ item.lib | default(r_packages_lib) }}
Expand All @@ -43,7 +43,7 @@

- name: packages | remove
command: >
R-remove-package
{{ r_scripts_install_path }}/R-remove-package
{{ item.name }}
{% if item.lib is defined %}{{ item.lib }}{% endif %}
environment: "{{ r_environment }}"
Expand All @@ -58,7 +58,7 @@

- name: packages | update
command: >
R-update-package
{{ r_scripts_install_path }}/R-update-package
{{ item.name }}
{{ item.type | default(r_packages_type) }}
{{ item.lib | default(r_packages_lib) }}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 0641195

Please sign in to comment.