ZEPPELIN-700. Add Ansible R role to Virtual Machine to support dependencies for the R Interpreter

This commit is contained in:
Jeff Steinmetz 2016-02-26 17:28:44 -08:00
parent a283dfa87f
commit b940bcddf0
3 changed files with 72 additions and 0 deletions

View file

@ -23,3 +23,4 @@
- nodejs
- maven
- python-addons
- r

View file

@ -0,0 +1,9 @@
# defaults variables for r role
---
r_cran_mirror: http://cran.rstudio.com/
r_repository:
- type: deb
url: "{{ r_cran_mirror }}/bin/linux/ubuntu {{ ansible_distribution_release }}/"
r_packages_repos: "{{ r_cran_mirror }}"

View file

@ -0,0 +1,62 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Install R binaries and CRAN packages
---
# The Ubuntu archives on CRAN are signed with a key with ID E084DAB9. Add this key to the system.
- name: repository | add public key
apt_key:
id: E084DAB9
keyserver: keyserver.ubuntu.com
state: present
# in order to get the latest version of R, add CRAN repository to the to the list of sources
- name: repository | add cran-r
apt_repository:
repo: "{{ item.type }} {{ item.url }}"
state: present
update_cache: true
with_items: r_repository
- name: Install R. This may take a while.
apt: pkg=r-base state=present
- name: Install R packages required for the R interpreter. This may take a while.
shell: /usr/bin/Rscript --slave --no-save --no-restore-history -e "if (! ('{{item}}' %in% installed.packages()[,'Package'])) install.packages(pkgs=c('{{item}}'), repos=c('{{r_packages_repos}}'))"
with_items:
- evaluate
- knitr
- name: Install R packages recommended for the R interpreter.
shell: /usr/bin/Rscript --slave --no-save --no-restore-history -e "if (! ('{{item}}' %in% installed.packages()[,'Package'])) install.packages(pkgs=c('{{item}}'), repos=c('{{r_packages_repos}}'))"
with_items:
- repr
- htmltools
- base64enc
# requirements for Plotly include libcurl and libssl
- name: Install libcurl
apt: pkg={{ item }} state=present
with_items:
- libcurl4-openssl-dev
- libssl-dev
- name: Install other helpful R packages
shell: /usr/bin/Rscript --slave --no-save --no-restore-history -e "if (! ('{{item}}' %in% installed.packages()[,'Package'])) install.packages(pkgs=c('{{item}}'), repos=c('{{r_packages_repos}}'))"
with_items:
- ggplot2
- plotly