微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Ansible 在 M1 Mac 上的 Rosetta 2 仿真下作为 `ansible_machine` 和 `ansible_architecture` 返回什么 参考资料

如何解决Ansible 在 M1 Mac 上的 Rosetta 2 仿真下作为 `ansible_machine` 和 `ansible_architecture` 返回什么 参考资料

在 M1 MacBook 上,ansible_architectureansible_machine 返回与 arm64 相同的值:

shuuji3@momo mac-dev-playbook
> ansible -m setup localhost | egrep '_architecture|_machine'
        "ansible_architecture": "arm64","ansible_machine": "arm64",

在 M1 Mac 上的 Rosetta 2 仿真下怎么样?

解决方法

在 M1 Mac 上使用 Rosetta 2 仿真(Intel 模式)时,Ansible 返回 x86_64 值,就像之前的 intel Mac:

shuuji3@momo ~ % ansible -m setup localhost | egrep '_architecture|_machine'
        "ansible_architecture": "arm64","ansible_machine": "arm64",# Run the shell on the Intel mode
shuuji3@momo ~ % env /usr/bin/arch -x86_64 /bin/zsh --login

shuuji3@momo ~ % ansible -m setup localhost | egrep '_architecture|_machine'
        "ansible_architecture": "x86_64","ansible_machine": "x86_64","ansible_userspace_architecture": "x86_64",

请注意,Ansible 添加了 ansible_userspace_architecture 事实。

参考资料

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。