2016-09-08 17:08:33 +02:00
---
- block :
- name : Install the gdebi tool
apt : pkg=gdebi-core state=latest update_cache=yes cache_valid_time=1800
2017-03-20 23:00:55 +01:00
- name : Install the apparmor utilities
apt : pkg=apparmor-utils state=present update_cache=yes cache_valid_time=1800
2016-09-08 17:08:33 +02:00
- name : Download the rstudio server deb package
2017-02-10 14:02:23 +01:00
# get_url: url={{ rstudio_download_url }} dest=/srv/{{ rstudio_file }}
shell : cd /srv ; wget {{ rstudio_download_url }}
args :
creates : /srv/{{ rstudio_file }}
2016-09-08 17:08:33 +02:00
register : rstudio_download
- name : Install the rstudio server package
command : gdebi -n -q /srv/{{ rstudio_file }}
when : ( rstudio_download | changed )
2017-03-20 23:00:55 +01:00
- name : Change the apparmor behaviour to complain, otherwise it cannot read the nslcd socket
shell : if [ -x /usr/sbin/apparmor_status ] ; then RETVAL=$( /usr/sbin/apparmor_status ) ; if [ $RETVAL -eq 0 ] ; then aa-complain /usr/lib/rstudio-server/bin/rserver ; fi ; fi
when : rstudio_enabled
2016-09-08 17:08:33 +02:00
- name : Ensure that rstudio server is enabled and running
service : name=rstudio-server state=started enabled=yes
when : rstudio_enabled
- name : Ensure that rstudio server is disabled and stopped
service : name=rstudio-server state=stopped enabled=no
when : not rstudio_enabled
2017-06-07 16:01:14 +02:00
- name : Install bc, needed by the script that kills abusing jobs
apt : pkg=bc state=present update_cache=yes cache_valid_time=3600
when : rstudio_install_kill_script
tags : [ 'rstudio' , 'rstudio_server' , 'rstudio_kill_rogues' ]
2017-06-06 19:47:22 +02:00
- name : Install a script that kills the abusing job processes
copy : src=kill-rogue-jobs dest=/usr/local/bin/kill-rogue-jobs owner=root group=root mode=0755
when : rstudio_install_kill_script
tags : [ 'rstudio' , 'rstudio_server' , 'rstudio_kill_rogues' ]
- name : Install a cron job that kills the abusing jobs
cron : name="Kill rogue jobs" job="/usr/local/bin/kill-rogue-jobs" user=root minute="{{ rstudio_kill_script_frequency }}"
when : rstudio_install_kill_script
tags : [ 'rstudio' , 'rstudio_server' , 'rstudio_kill_rogues' ]
2016-09-08 17:08:33 +02:00
when : rstudio_install_server
tags : [ 'rstudio' , 'rstudio_server' ]
- block :
- name : Ensure that rstudio server is disabled and stopped
service : name=rstudio-server state=stopped enabled=no
- name : Remove the rstudio-server and gdebi packages
apt : pkg={{ item }} state=absent
with_items :
- gdebi
- rstudio-server
2017-06-06 19:47:22 +02:00
- name : Remove the script that kills the abusing job processes
file : dest=/usr/local/bin/kill-rogue-jobs state=absent
- name : Remove the cron job that kills the abusing jobs
cron : name="Kill rogue jobs" job="/usr/local/bin/kill-rogue-jobs" user=root minute="{{ rstudio_kill_script_frequency }}" state=absent
2016-09-08 17:08:33 +02:00
when : not rstudio_install_server
tags : [ 'rstudio' , 'rstudio_server' ]