我正在尝试使用Ansiblefacts来查找机器的架构。
\n我们可以通过运行命令来收集有关机器的信息ansible -m setup <host-name>
,如文档中所述:发现变量:事实和魔术变量 \xe2\x80\x94 Ansible 文档。
但看起来 和ansible_architecture
是ansible_machine
相同的值。我不确定它们之间的区别。上述文档中的示例显示了以下两个具有相同值的值:
"ansible_architecture": "x86_64",\n "ansible_machine": "x86_64",\n
Run Code Online (Sandbox Code Playgroud)\n在我的 M1 MacBook 上,结果是这样的:
\nshuuji3@momo mac-dev-playbook\n> ansible -m setup localhost | egrep \'_architecture|_machine\'\n "ansible_architecture": "arm64",\n "ansible_machine": "arm64",\n
Run Code Online (Sandbox Code Playgroud)\n我们可以互换使用这些值吗?或者在另一种情况下它们可以有其他值吗?
\n在 M1 MacBook 上,ansible_architecture
和ansible_machine
返回相同的值arm64
:
shuuji3@momo mac-dev-playbook
> ansible -m setup localhost | egrep '_architecture|_machine'
"ansible_architecture": "arm64",
"ansible_machine": "arm64",
Run Code Online (Sandbox Code Playgroud)
在 M1 Mac 上的 Rosetta 2 仿真下怎么样?