1

I'm running into issues in an Ansible script which has a test for Apple M1 processors.

I have an M2 so I'll need to turn this into a list of processors that we can expand as M3s and what not gets released.

I do however wish to make this list as complete as possible now already and I'm looking for a list of possible values in ansible_processor. Or at least what source is used to populate that var.

U880D
  • 8,601
  • 6
  • 24
  • 40
Enok82
  • 163
  • 1
  • 13

1 Answers1

1

Regarding

I'm looking for a list of possible values in ansible_processor

you may need to have a look into to source code of the relevant modules, there can be found background information of what is collected for specific environments and setups, in example for your question under /ansible/module_utils/facts/hardware.

Or at least what source is used to populate that var.

For your OS it should be darwin.py and as you can see from the source there

    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 do not maintain a list of hardware, but get only a string with information back from the OS which it is using then.

Therefore no list of possible values can be provided.

Further Q&A

which might also be interesting about gathering facts ...

Documentation

Further Readings

U880D
  • 8,601
  • 6
  • 24
  • 40