Last active
April 26, 2024 17:58
-
-
Save eby/740dd7ccc6bba8cd73004d33a25f10e0 to your computer and use it in GitHub Desktop.
Get OS version for an inventory with ad-hoc ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The setup command allows filtering facts | |
# More info: https://docs.ansible.com/ansible/latest/modules/setup_module.html | |
# inventory_file = path to inventory file (if not normal role layout) | |
# host_group = group to query. use all for all hosts | |
ansible -i inventory_file host_group -m setup -a 'filter=ansible_distribution_version' | |
# For a Ubuntu Bionic Host the distribution facts look like this: | |
# "ansible_distribution": "Ubuntu", | |
# "ansible_distribution_file_parsed": true, | |
# "ansible_distribution_file_path": "/etc/os-release", | |
# "ansible_distribution_file_variety": "Debian", | |
# "ansible_distribution_major_version": "18", | |
# "ansible_distribution_release": "bionic", | |
# "ansible_distribution_version": "18.04" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment