-
Notifications
You must be signed in to change notification settings - Fork 18
Differentiating platform by ansible variables
Kirk Wilson edited this page Mar 16, 2021
·
19 revisions
We often need to have conditional logic inside the ansible playbooks depending on the OS and hardware platform. This documents the common permutations. We don’t capture all the output of ansible -m setup
but this should be enough to serve as a reference. Variables come from an ansible -m setup
run using Ansible 2.1.2.0
Ansible Variable | Raspberry PI 4b+ | Raspberry Pi3b+ | Raspberry Pi Zero W | NanoPi NEO | VirtualBox | AWS | NanoPI NEO3 |
---|---|---|---|---|---|---|---|
ansible_architecture | armv8 A72 | armv8 A53 | armv6l | armv7l | x86_64 | x86_64 | RockChip A53 |
ansible_bios_version | NA | NA | NA | NA | VirtualBox | 4.2.amazon | NA |
ansible_processor_cores | 1 | 1 | 1 | 1 | (depends) | (depends) | 1 |
ansible_processor_count | 4 | 4 | 1 | 4 | (depends) | (depends) | 4 |
ansible_virtualization_type | NA | NA | NA | NA | VirtualBox | xen | NA |
ansible_processor has an inconsistent length but ansible_processor[0] is:
- Raspberry Pi 4b+: ARMv8 Processor rev ? (v72)
- Raspberry Pi 3b+: ARMv7 Processor rev 4 (v7l)
- Raspberry Pi Zero W: ARMv6-compatible processor rev 7 (v6l)
- NanoPi Neo : ARMv7 Processor rev 5 (v7l)
- NanoPi Neo3: ARMv8 A53 Processor rev ? (?)
(Information is too wide to put into the table above)
Ansible Variable | Jessie | Xenial | Raspbian Jessie | Raspbian Stretch | Armbian Jessie | Armbian Xenial | Armbian Buster |
---|---|---|---|---|---|---|---|
ansible_os_family | Debian | Debian | Debian | Debian | Debian | Debian | Debian |
ansible_distribution | Debian | Ubuntu | Debian | Debian | Debian | Ubuntu | Debian |
ansible_lsb["id"] | Debian | Ubuntu | Raspbian | Raspbian | Debian | Ubuntu | Debian |
connectbox_os | debian | ubuntu | raspbian | ??? | armbian | armbian | armbian |
ansible_lsb["codename"] | jessie | xenial | jessie | stretch | jessie | xenial | Buster |
ansible_lsb["major_release"] | 8 | 16 | 8 | 9 | 8 | 16 | 5 |
ansible_lsb["release"] | 8.7 | 16.04 | 8.0 | 9. | 8.7 | 16.04 | 10.y |
The release version of Jessie increments based on periodic releases. Xenial does not.
Differentiating an Armbian installation from the corresponding Ubuntu or Jessie release is currently done by checking for the presence of /etc/armbian.txt or /etc/armbian-release
Feature Requests and Bug reports