使用角色启动 ansible playbook 时出错
Error in launching ansible playbook with roles
正在尝试编写剧本:
- hosts: win
gather_facts: no
roles:
- update_win
update_win mail.yml:
- name: Create Auto_deploy_temp folder on remoter host
win_file:
path: {{ disk }}\Auto_deploy_temp
state: directory
和组变量文件中的变量 win.yml:
disk: 'c:'
但要出去:
ERROR! Syntax Error while loading YAML.
did not find expected key
The error appears to be in '/etc/ansible/roles/update_win/tasks/main.yml': line 3, column 19, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
win_file:
path: {{ disk }}\Auto_deploy_temp
^ 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 }}"
can u help me with this issue?
P.S.: 早些时候我推出了一些类似的代码,但是路径表达式的开头没有变量,只有在结尾
请提供路径:“{{磁盘}}\Auto_deploy_temp”
更新
创建一个新的 var 作为 path_dir: \Auto_deploy_temp,并使用
路径:“{{disk}}{{path_dir}}”
或
路径:“{{磁盘}}\\Auto_deploy_temp”
转义'\'
win_file:
path: {{ disk }}\Auto_deploy_temp
正在尝试编写剧本:
- hosts: win
gather_facts: no
roles:
- update_win
update_win mail.yml:
- name: Create Auto_deploy_temp folder on remoter host
win_file:
path: {{ disk }}\Auto_deploy_temp
state: directory
和组变量文件中的变量 win.yml:
disk: 'c:'
但要出去:
ERROR! Syntax Error while loading YAML.
did not find expected key
The error appears to be in '/etc/ansible/roles/update_win/tasks/main.yml': line 3, column 19, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
win_file:
path: {{ disk }}\Auto_deploy_temp
^ 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 }}"
can u help me with this issue?
P.S.: 早些时候我推出了一些类似的代码,但是路径表达式的开头没有变量,只有在结尾
请提供路径:“{{磁盘}}\Auto_deploy_temp”
更新
创建一个新的 var 作为 path_dir: \Auto_deploy_temp,并使用
路径:“{{disk}}{{path_dir}}”
或
路径:“{{磁盘}}\\Auto_deploy_temp”
转义'\'
win_file:
path: {{ disk }}\Auto_deploy_temp