[英]Ansible - Wrapper of python interpreter
Ansible uses YAML syntax mainly has key-value pairs, where every value can be Ansible使用YAML语法主要具有键值对,其中每个值都可以是
a simple value (number or string) 一个简单值(数字或字符串)
or 要么
a list 一个列表
or 要么
a key-value pair(nested) 键值对(嵌套)
Anchoring a value, Type conversion in YAML is just a pre-processing option. 锚定一个值,YAML中的类型转换只是一个预处理选项。
1) 1)
From the data structure aspect, 从数据结构方面来看,
Is YAML syntax a dictionary of dictionary? YAML语法是词典的词典吗?
2) 2)
For command: ansible -m shell 'hostname' all
, Is ansible
a wrapper of python interpreter? 对于命令:
ansible -m shell 'hostname' all
ansible
, ansible
是python解释器的包装吗? taking multiple command line options... 采取多个命令行选项...
From the data structure aspect,
从数据结构方面来看,
Is YAML syntax a dictionary of dictionary?
YAML语法是词典的词典吗?
No. YAML syntax models a directed graph. 不。YAML语法为有向图建模。 Your assumptions on YAML given initially are wrong.
您最初给出的有关YAML的假设是错误的。 In YAML, a value is one of three things:
在YAML中,值是三件事之一:
Since any non-scalar value can contain other non-scalar values, YAML can represent a tree of arbitrary depth – so it's not necessarily a dictionary of dictionaries. 由于任何非标量值都可以包含其他非标量值,因此YAML可以表示任意深度的树-因此它不一定是字典的字典。
Now, YAML also allows to have an anchor on any value, and reference that value later via alias: 现在,YAML还允许在任何值上使用锚,并在以后通过别名引用该值:
anchored value: &anchor My value
alias: *anchor
Here, *alias
references the anchored scalar value My value
. 在此,
*alias
引用锚定标量值My value
。 This can be used to define cyclic graphs: 这可以用来定义循环图:
--- &root # this annotates the root sequence;
- one
- two # simple sequence items
- three
- *root # reference to the sequence, meaning that the sequence contains itself
Mind that both sequence and mappings are usually started implicitly in YAML syntax. 请注意,序列和映射通常都是以YAML语法隐式开始的。 If children are key/value pairs, it's a mapping (first example);
如果子代是键/值对,则为映射(第一个示例); if children are list items, it's a sequence (second example).
如果子项是列表项,则为序列(第二个示例)。
---
starts the document and is usually omitted. ---
开始文档,通常省略。
For command: ansible -m shell 'hostname' all, Is ansible a wrapper of python interpreter?
对于命令:ansible -m shell'hostname'全部,ansible是python解释器的包装吗? taking multiple command line options...
采取多个命令行选项...
See the man page of the ansible command . 请参见ansible命令的手册页 。 You are probably looking for the
-a ARGS
option. 您可能正在寻找
-a ARGS
选项。 I am unsure what you would consider a wrapper of the Python interpreter and you may want to clarify what you actually want to do. 我不确定您会认为Python解释器的包装是什么,并且您可能想澄清一下您实际想要做什么。 Generally, the answer to that is no .
通常,答案是否定的 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.