我在教自己,我有兩個簡單的文件。我想在數字海洋服務器上安裝R和一些軟件包。通過shell安裝r軟件包時出現錯誤
主機[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
我從this question明白我不應該使用command
選項,但shell
命令。
我仍然得到這個錯誤。
$ ansible-playbook -i hosts -k playbook.yml
SSH password:
ERROR: Syntax Error while loading YAML script, playbook.yml
Note: The error may actually appear before this position: line 10, column 1
- name: install plyr
shell: echo "install.packages('plyr', repos=c('http://www.freestatistics.org/cran/'))" | R --no-save
^
但是,如果我ssh進入機器,確切的命令似乎工作正常。
[email protected]<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 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> install.packages('plyr', repos=c('http://www.freestatistics.org/cran/'))
Installing package(s) into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning: dependency ‘Rcpp’ is 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
任何人都可以指出我的劇本有什麼問題嗎?
你跑哪個版本?你的playbook在這裏運行得很好。 – leucos 2014-10-11 10:27:43