ansible error when installing r packages through shell -



ansible error when installing r packages through shell -

i teaching myself ansible , have 2 simple files. want install r , packages on digital ocean server.

hosts [droplets] <ip adress> playbook.yml - hosts: droplets user: root sudo: true vars: - foo: hello there ansible tasks: - name: install r apt: name=r-base state=installed - name: install plyr shell: echo "install.packages('plyr', repos=c('http://www.freestatistics.org/cran/'))" | r --no-save

i understood this question should not utilize command alternative shell command instead.

i still error.

$ ansible-playbook -i hosts -k playbook.yml ssh password: error: syntax error while loading yaml script, playbook.yml note: error may appear before position: line 10, column 1 - name: install plyr shell: echo "install.packages('plyr', repos=c('http://www.freestatistics.org/cran/'))" | r --no-save ^

however, if ssh machine, exact command seems work fine.

root@<ip adress>:~# echo "install.packages('plyr', repos=c('http://www.freestatistics.org/cran/'))" | r --no-save r version 2.15.1 (2012-06-22) -- "roasted marshmallows" copyright (c) 2012 r foundation statistical computing isbn 3-900051-07-0 platform: x86_64-pc-linux-gnu (64-bit) r free software , comes absolutely no warranty. welcome redistribute under conditions. type 'license()' or 'licence()' distribution details. natural language back upwards running in english language locale r collaborative project many contributors. type 'contributors()' more info , 'citation()' on how cite r or r packages in publications. type 'demo()' demos, 'help()' on-line help, or 'help.start()' html browser interface help. type 'q()' quit r. > install.packages('plyr', repos=c('http://www.freestatistics.org/cran/')) installing package(s) ‘/usr/local/lib/r/site-library’ (as ‘lib’ unspecified) warning: dependency ‘rcpp’ not available trying url 'http://www.freestatistics.org/cran/src/contrib/plyr_1.8.1.tar.gz' content type 'application/x-gzip' length 393233 bytes (384 kb) opened url ================================================== downloaded 384 kb

can pin point wrong playbook?

what you're doing looks fine, command bit safer in general , can utilize rscript perform task , avoid echoing & piping:

- command: rscript --vanilla -e "install.packages('plyr', repos=c('http://www.freestatistics.org/cran/'))"

if install littler (which apt-get-able package) can issue command link available location:

- apt: name=littler state=installed - command: ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r

then utilize farther pkg installs succinctly:

- command: install.r plyr

r shell ansible ansible-playbook

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -