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 }}"
お勧めします。