Skip to content

Commit b940bcd

Browse files
committed
ZEPPELIN-700. Add Ansible R role to Virtual Machine to support dependencies for the R Interpreter
1 parent a283dfa commit b940bcd

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

scripts/vagrant/zeppelin-dev/ansible-roles.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
- nodejs
2424
- maven
2525
- python-addons
26+
- r
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# defaults variables for r role
2+
---
3+
r_cran_mirror: http://cran.rstudio.com/
4+
5+
r_repository:
6+
- type: deb
7+
url: "{{ r_cran_mirror }}/bin/linux/ubuntu {{ ansible_distribution_release }}/"
8+
9+
r_packages_repos: "{{ r_cran_mirror }}"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Install R binaries and CRAN packages
17+
---
18+
19+
# The Ubuntu archives on CRAN are signed with a key with ID E084DAB9. Add this key to the system.
20+
- name: repository | add public key
21+
apt_key:
22+
id: E084DAB9
23+
keyserver: keyserver.ubuntu.com
24+
state: present
25+
26+
# in order to get the latest version of R, add CRAN repository to the to the list of sources
27+
- name: repository | add cran-r
28+
apt_repository:
29+
repo: "{{ item.type }} {{ item.url }}"
30+
state: present
31+
update_cache: true
32+
with_items: r_repository
33+
34+
- name: Install R. This may take a while.
35+
apt: pkg=r-base state=present
36+
37+
- name: Install R packages required for the R interpreter. This may take a while.
38+
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}}'))"
39+
with_items:
40+
- evaluate
41+
- knitr
42+
43+
- name: Install R packages recommended for the R interpreter.
44+
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}}'))"
45+
with_items:
46+
- repr
47+
- htmltools
48+
- base64enc
49+
50+
# requirements for Plotly include libcurl and libssl
51+
- name: Install libcurl
52+
apt: pkg={{ item }} state=present
53+
with_items:
54+
- libcurl4-openssl-dev
55+
- libssl-dev
56+
57+
- name: Install other helpful R packages
58+
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}}'))"
59+
with_items:
60+
- ggplot2
61+
- plotly
62+

0 commit comments

Comments
 (0)