From 639d0397bef2ea11d3e83eaece4696d324a07fb2 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 8 Sep 2016 17:08:33 +0200 Subject: [PATCH] library/roles/rstudio-server: Simple role that installs an rstudio-server instance on debian. --- rstudio-server/defaults/main.yml | 6 ++++++ rstudio-server/tasks/main.yml | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 rstudio-server/defaults/main.yml create mode 100644 rstudio-server/tasks/main.yml diff --git a/rstudio-server/defaults/main.yml b/rstudio-server/defaults/main.yml new file mode 100644 index 0000000..0441c82 --- /dev/null +++ b/rstudio-server/defaults/main.yml @@ -0,0 +1,6 @@ +--- +rstudio_install_server: False +rstudio_enabled: True +rstudio_file: rstudio-server-0.99.903-amd64.deb +rstudio_download_url: 'https://download2.rstudio.org/{{ rstudio_file }}' + diff --git a/rstudio-server/tasks/main.yml b/rstudio-server/tasks/main.yml new file mode 100644 index 0000000..7380afc --- /dev/null +++ b/rstudio-server/tasks/main.yml @@ -0,0 +1,37 @@ +--- +- block: + - name: Install the gdebi tool + apt: pkg=gdebi-core state=latest update_cache=yes cache_valid_time=1800 + + - name: Download the rstudio server deb package + get_url: url='{{ rstudio_download_url }}' dest=/srv/{{ rstudio_file }} + register: rstudio_download + + - name: Install the rstudio server package + command: gdebi -n -q /srv/{{ rstudio_file }} + when: ( rstudio_download | changed ) + + - 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 + + 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 + + when: not rstudio_install_server + tags: [ 'rstudio', 'rstudio_server' ]