【问题标题】:Is there a list of possible 'ansible_processors' values?是否有可能的 \'ansible_processors\' 值的列表?
【发布时间】:2022-08-18 16:40:08
【问题描述】:

我在一个对 Apple M1 处理器进行测试的 Ansible 脚本中遇到了问题。

我有一个 M2,所以我需要把它变成一个处理器列表,我们可以将其扩展为 M3,而哪些没有发布。

但是,我现在确实希望使该列表尽可能完整,并且我正在寻找ansible_processor 中的可能值列表。或者至少使用什么源来填充该变量。

    标签: ansible ansible-facts apple-silicon


    【解决方案1】:

    关于

    我正在寻找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 不维护硬件列表,而仅从它正在使用的操作系统中获取包含信息的字符串。

    因此无法提供可能值的列表。

    进一步问答

    收集事实可能也很有趣...

    文档

    进一步阅读

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-28
      • 1970-01-01
      相关资源
      最近更新 更多