【发布时间】:2022-08-18 16:40:08
【问题描述】:
我在一个对 Apple M1 处理器进行测试的 Ansible 脚本中遇到了问题。
我有一个 M2,所以我需要把它变成一个处理器列表,我们可以将其扩展为 M3,而哪些没有发布。
但是,我现在确实希望使该列表尽可能完整,并且我正在寻找ansible_processor 中的可能值列表。或者至少使用什么源来填充该变量。
标签: ansible ansible-facts apple-silicon
我在一个对 Apple M1 处理器进行测试的 Ansible 脚本中遇到了问题。
我有一个 M2,所以我需要把它变成一个处理器列表,我们可以将其扩展为 M3,而哪些没有发布。
但是,我现在确实希望使该列表尽可能完整,并且我正在寻找ansible_processor 中的可能值列表。或者至少使用什么源来填充该变量。
标签: ansible ansible-facts apple-silicon
关于
我正在寻找
ansible_processor中的可能值列表您可能需要查看相关模块的源代码,可以找到针对特定环境和设置收集的背景信息,例如/ansible/module_utils/facts/hardware 下的问题。
对于您的操作系统,它应该是
darwin.py并且您可以从那里的源代码中看到def get_cpu_facts(self): cpu_facts = {} if 'machdep.cpu.brand_string' in self.sysctl: # Intel cpu_facts['processor'] = self.sysctl['machdep.cpu.brand_string'] ... else: # PowerPC system_profile = self.get_system_profile() cpu_facts['processor'] = '%s @ %s' % (system_profile['Processor Name'], system_profile['Processor Speed']) ...Ansible 不维护硬件列表,而仅从它正在使用的操作系统中获取包含信息的字符串。
因此无法提供可能值的列表。
进一步问答
收集事实可能也很有趣...
- How Ansible gather_facts and sets variables
- What is the exact list of Ansible setup min?
- What does Ansible return as
ansible_machineandansible_architectureunder the Rosetta 2 emulation on M1 Mac- What is the difference between
ansible_architectureandansible_machineon Ansible?文档
进一步阅读
【讨论】: