ansible-role-R/tasks/r-packages-updater.yml

90 lines
3.1 KiB
YAML
Raw Normal View History

2021-02-25 14:09:55 +01:00
---
2021-07-02 15:52:58 +02:00
- name: Manage the subversion repository
block:
- name: Create the R packages updater SVN base directory
file:
dest: '{{ r_packages_svn_base_dir }}'
state: directory
when:
- r_cran_install_from_sources
- r_packages_updater
- r_package_updater_via_subversion
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]
- name: Manage the git repository of the packages lists
block:
- name: Remove the R packages updater SVN base directory
file:
dest: '{{ r_packages_svn_base_dir }}/RPackagesManagement'
state: absent
- name: Create the R packages updater git base directory
file:
dest: '{{ r_packages_git_base_dir }}'
state: directory
when:
- r_cran_install_from_sources
- r_packages_updater
- r_package_updater_via_git
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]
2021-02-25 14:09:55 +01:00
- block:
- name: Install the R packages updater script
template:
src: 'update_r_packages.sh.j2'
dest: '/usr/local/bin/update_r_packages'
owner: root
group: root
mode: '0755'
- name: Cron job that installs new R packages, if any
cron:
name: "install new R packages"
user: root
cron_file: install-r-packages
minute: "*/10"
hour: "5-23,1-2"
job: "/usr/local/bin/update_r_packages install >/var/log/install_r_packages 2>&1"
state: present
- name: Cron job that upgrades existing R packages and installs new ones, if any
cron:
name: "Upgrade installed R packages"
user: root
cron_file: upgrade-r-packages
minute: "7"
hour: "3"
job: "/usr/local/bin/update_r_packages upgrade >/var/log/update_r_packages 2>&1"
state: present
when: r_packages_updater_also_upgrades_installed_packages
2021-03-02 11:27:16 +01:00
when:
- r_cran_install_from_sources
- r_packages_updater
2021-02-25 14:09:55 +01:00
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]
- block:
- name: Remove the R packages updater script
file: dest=/usr/local/bin/update_r_packages state=absent
- name: Remove the R packages updater SVN base directory
file: dest={{ r_packages_svn_base_dir }} state=absent
- name: Remove the cron job that installs new R packages
file: dest=/etc/cron.d/install-r-packages state=absent
- name: Remove the cron job that upgrades existing R packages and installs new ones
file: dest=/etc/cron.d/upgrade-r-packages state=absent
when: not r_packages_updater
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]
- block:
- name: Disable the cron job that upgrades already installed R packages
file: dest=/etc/cron.d/upgrade-r-packages state=absent
when: not r_packages_updater_also_upgrades_installed_packages
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]