英文:
Ansible module and tags on single line
问题
可以将这些ansible任务写成单行,例如(不起作用):
- import_tasks: foo/spam.yml tags="foo, spam"
- import_tasks: foo/ham.yml tags="foo, ham"
- import_tasks: foo/eggs.yml tags="foo, eggs"
英文:
Consider these ansible tasks:
- import_tasks: foo/spam.yml
tags: foo, spam
- import_tasks: foo/ham.yml
tags: foo, ham
- import_tasks: foo/eggs.yml
tags: foo, eggs
Is it possible to write those on single lines, e.g. (doesn't work)
- import_tasks: foo/spam.yml tags="foo, spam"
- import_tasks: foo/ham.yml tags="foo, ham"
- import_tasks: foo/eggs.yml tags="foo, eggs"
答案1
得分: 2
您的操作手册需要使用有效的YAML语法。由于YAML是JSON的超集,您可以这样编写:
- {"import_tasks": "foo/spam.yml", "tags": "foo, spam"}
- {"import_tasks": "foo/ham.yml", "tags": "foo, ham"}
- {"import_tasks": "foo/eggs.yml", "tags": "foo, eggs"}
英文:
Your playbook needs to use valid YAML syntax. Since YAML is a superset of JSON, you could write:
- {"import_tasks": "foo/spam.yml", "tags": "foo, spam"}
- {"import_tasks": "foo/ham.yml", "tags": "foo, ham"}
- {"import_tasks": "foo/eggs.yml", "tags": "foo, eggs"}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论