Ansible模块和标签放在同一行。

huangapple go评论82阅读模式
英文:

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"}

huangapple
  • 本文由 发表于 2023年5月18日 11:05:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76277462.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定