I have been trying to write playbooks where I can run different tasks based on the arch (i.e amd64, arm, ppc64le) that the playbook is running on. I can not figure out how do I get the arch of the system I am running it on.
How to figure out the arch of the system in Ansible playbook?
Ansible gathers suitable information from target hosts and stores it as facts, for example: ansible_architecture
, ansible_os_family
.
If you are in doubt, you can display all facts with the debug
module and choose the ones that suit you best.
You can use the ansible_architecture
facts in when
conditions, and use it to include different task-files (an example to customise).