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

102 lines
4.0 KiB
YAML

---
- name: r-packages-updater | Manage the subversion repository
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']
block:
- name: r-packages-updater | Create the R packages updater SVN base directory
ansible.builtin.file:
dest: '{{ r_packages_svn_base_dir }}'
state: directory
owner: root
group: root
mode: "0755"
- name: r-packages-updater | Manage the git repository of the packages lists
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']
block:
- name: r-packages-updater | Remove the R packages updater SVN base directory
ansible.builtin.file:
dest: '{{ r_packages_svn_base_dir }}/RPackagesManagement'
state: absent
- name: r-packages-updater | Create the R packages updater git base directory
ansible.builtin.file:
dest: '{{ r_packages_git_base_dir }}'
state: directory
owner: root
group: root
mode: "0755"
- name: r-packages-updater | Scripts that install/update R packages
tags: ['r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater']
block:
- name: r-packages-updater | Install the R packages updater script
ansible.builtin.template:
src: 'update_r_packages.sh.j2'
dest: '/usr/local/bin/update_r_packages'
owner: root
group: root
mode: '0755'
- name: r-packages-updater | Cron jobs that install/update R packages
when:
- r_cran_install_from_sources
- r_packages_updater
tags: ['r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater']
block:
- name: r-packages-updater | Cron job that installs new R packages, if any
ansible.builtin.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: r-packages-updater | Cron job that upgrades existing R packages and installs new ones, if any
ansible.builtin.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
- name: r-packages-updater | Remove the update scripts
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: r-packages-updater | Remove the R packages updater SVN base directory
ansible.builtin.file:
dest: "{{ r_packages_svn_base_dir }}"
state: absent
- name: r-packages-updater | Remove the cron job that installs new R packages
ansible.builtin.file:
dest: /etc/cron.d/install-r-packages
state: absent
- name: r-packages-updater | Remove the cron job that upgrades existing R packages and installs new ones
ansible.builtin.file:
dest: /etc/cron.d/upgrade-r-packages
state: absent
- name: r-packages-updater | Disable the cron job that updates the R packages
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']
block:
- name: r-packages-updater | Disable the cron job that upgrades already installed R packages
ansible.builtin.file:
dest: /etc/cron.d/upgrade-r-packages
state: absent