ansible playbook尝试打印调试字符串但未成功
我尝试在playbook中运行ansible任务,该任务应使用调试模块打印简单消息。这是我的剧本配置:ansible playbook尝试打印调试字符串但未成功,ansible,Ansible,我尝试在playbook中运行ansible任务,该任务应使用调试模块打印简单消息。这是我的剧本配置: --- 2 3 - name: s3 handller 4 connection: local 5 gather_facts: false 6 hosts: localhost 7 tasks: 8 9 - name: Display the config 10 - debug: 11 msg:
---
2
3 - name: s3 handller
4 connection: local
5 gather_facts: false
6 hosts: localhost
7 tasks:
8
9 - name: Display the config
10 - debug:
11 msg: "Hello you"
12
13 - name: Display env vars
14 - debug:
15 msg:"{{ lookup('env','HOME') }} is an environment variable"
16
启动时,我收到以下错误消息:
ansible-playbook create_s3.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed here
The error appears to have been in '/home/user/create_s3.yml': line 10, column 16, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Display the config
- debug:
^ here
如果标记任务,则模块名称前面的连字符(
-debug:
)是不允许的。您可以在第五个示例中看到
错误消息
此处不允许使用映射值
表示在-name:
因此,您可以通过以下自适应来解决此问题:
9 - name: Display the config
10 debug:
11 msg: "Hello you"
另外,请注意msg:
字段所需的缩进-YAML依赖缩进,并且非常严格
希望我能帮助您。如果您为任务添加标签,则模块名称前面的连字符(
-debug:
)是不允许的。您可以在第五个示例中看到
错误消息
此处不允许使用映射值
表示在-name:
因此,您可以通过以下自适应来解决此问题:
9 - name: Display the config
10 debug:
11 msg: "Hello you"
另外,请注意msg:
字段所需的缩进-YAML依赖缩进,并且非常严格
我希望我能帮助你