0
ich folgendes ansible Textbuch geschrieben habe, um Dateien zu übertragen:Syntaxfehler in ansible Textbuch, wenn Variablen
---
- 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
Aber es gibt die folgende Fehlermeldung, wenn ansible Variablen. Wenn wir keine Variablen verwenden, funktioniert es absolut gut.
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 }}"
Bitte vorschlagen.