2014-10-11 4 views
0

나는 스스로를 가르치고 있으며 두 개의 간단한 파일이 있습니다. 디지털 바다 서버에 R 및 일부 패키지를 설치하고 싶습니다.쉘을 통해 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 

나는 내가 command 옵션 대신 shell 명령을 사용하지 않도록 this question에서 이해했다.

이 오류가 계속 발생합니다.

$ 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 

내 플레이 북에 무엇이 잘못 되었나요?

+0

어떤 버전을 실행합니까? 게임 북은 잘 작동합니다. – leucos

답변

1

당신이하고있는 것은 잘 보이지만, command은 일반적으로 조금 더 안전하고 당신은 작업을 수행 할 Rscript를 사용하여 반향 & 배관 피할 수 있습니다 : 당신이 littler를 설치하는 경우를 인 (

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

apt-get -able 패키지)는 다음 일반적으로 사용 가능한 위치에 연결하기 위해 command을 실행할 수 있습니다 : 다음 더 PKG 기능을 수행하는 데 사용할

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

을 매우 간결하게 높이 쳐서 :

- command: install.r plyr 
+1

'command'는 더 안전하지만, ** shell은 pipe **에서 명시 적으로 작동하지 않습니다. – tedder42

+0

Rscript 명령은 오류없이 실행되는 것 같지만 컴퓨터에 ssh를 설치하면'''plyr''가 설치되었는지 확인할 수 없습니다. 이것은 태스크의 출력이다.'''TASK : [command Rscript -vanilla -e "install.packages ('plyr', repos = c ('http://www.freestatistics.org/cran/'))" ] *** 변경 : 37.139.10.170] 재생 RECAP ********************************** ********************** 37.139.10.170 : ok = 3 변경됨 = 1 도달 할 수 없음 = 0 실패 = 0''' – cantdutchthis

+0

나는 littler 설치 프로그램을 시험해 보았고 동일한 결과가 출력되었습니다. ''TASK [dplyr, ggplot2 install.r 명령 stringr] ******************************* 변경됨 [37.139.10.170]'''... 그것에 대해 무엇을 할 생각입니까? 그것은 실제로 아무것도 설치하지 않는 것 ... – cantdutchthis

관련 문제