diff --git a/tasks/r-packages-install.yml b/tasks/r-packages-install.yml index 9d6d4cf..2f12fef 100644 --- a/tasks/r-packages-install.yml +++ b/tasks/r-packages-install.yml @@ -19,7 +19,7 @@ tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ] - block: - - name: Install R packages from the cran sources repo or from an alternative repository, latest available version. First try + - name: Install R packages from the cran sources repo or from an alternative repository, latest available version. command: > Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.name }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item.name }}', repos=c('{{ item.repo | default ('https://cloud.r-project.org') }}/')); print('Added'); } else { print('Already installed'); }" register: install_plugins_result @@ -33,7 +33,7 @@ with_items: '{{ r_plugins_from_sources | default([]) }}' tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ] - - name: Install R packages from the cran sources, specific versions. First round + - name: Install R packages from the cran sources, specific versions. command: > Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.name }}' %in% installed.packages()[,'Package'])) { install.packages('{{ r_source_plugins_dest_dir }}/{{ item.source }}', repos = NULL, type='source'); print('Added'); } else if (packageVersion('{{ item.name }}') != '{{ item.version }}') { install.packages('{{ r_source_plugins_dest_dir }}/{{ item.source }}', repos = NULL, type='source'); print('Added'); } else { print('Already Installed'); }" register: install_s_plugins_result @@ -53,16 +53,6 @@ tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github' ] ignore_errors: True - - name: Install R packages from the cran sources, specific versions. - command: > - Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.name }}' %in% installed.packages()[,'Package'])) { install.packages('{{ r_source_plugins_dest_dir }}/{{ item.source }}', repos = NULL, type='source'); print('Added'); } else if (packageVersion('{{ item.name }}') != '{{ item.version }}') { install.packages('{{ r_source_plugins_dest_dir }}/{{ item.source }}', repos = NULL, type='source'); print('Added'); } else { print('Already Installed'); }" - register: install_v_plugins_result - failed_when: "install_v_plugins_result.rc != 0 or 'had non-zero exit status' in install_v_plugins_result.stderr" - changed_when: '"Added" in install_s_plugins_result.stdout' - with_items: '{{ r_plugins_from_sources | default([]) }}' - ignore_errors: True - tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ] - - name: Remove R unwanted packages command: > Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item }}' %in% installed.packages()[,'Package'])) { print('Not installed'); } else { remove.packages(pkgs='{{ item }}'); print('Removed'); }"