Issue
There is a text file on the target node: /etc/debian_version
:
8.6
In Ansible, I want to export this number to a variable, inside of a task. Is there some Ansible built-in module that can accomplish this in a simple manner?
I use the below Ansible versions with Python 3.7:
ansible==4.10.0
ansible-core==2.11.12
Solution
For posterity, the route I took was:
- Install
lsb-release
usingapt
- It was not previously installed on my Debian
- Then, thanks to Ansible facts:
when: ansible_facts["lsb"]["major_release"] | int == 11
Answered By - Intrastellar Explorer Answer Checked By - Timothy Miller (WPSolving Admin)