0
我写了下面的Ansible剧本传输文件变量时:语法错误在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 }}"
请建议。