2017-04-27 4 views
0

변수를 사용하여 :구문 오류가 나는 파일을 전송하려면 다음 Ansible 각본을 쓴

--- 
- hosts: webservers 
    vars: 
    appname: myapp 
    repofile: /etc/ansible/packagerepo/scripts/ 
    become: yes 
    tasks: 
    - name: Copy tomcat template file. 
     copy: 
     src: "{{ repofile }}"/tomcat_template.sh 
     dest: /apps/bin/tomcat_template.sh 

    - name: Copy App template file 
     copy: 
     src: "{{ repofile }}"/app_template 
     dest: /etc/init.d/app_template 

그러나 Ansible 변수를 사용할 때 다음과 같은 오류를주고 있어요. 변수를 사용하지 않는다면 절대적으로 문제가되지 않습니다.

The offending line appears to be: 

    #src: /etc/ansible/packagerepo/scripts/tomcat_template.sh 
    src: "{{ repofile }}"/tomcat_template.sh 
         ^here 
We could be wrong, but this one looks like it might be an issue with 
missing quotes. Always quote template expression brackets when they 
start a value. For instance: 
with_items: 
    - {{ foo }} 

Should be written as: 
with_items: 
    - "{{ foo }}" 

제안 해주십시오.

답변

2

견적 전체 문자열 :

src: "{{ repofile }}/tomcat_template"