Currently when we are creating an AMI in AWS using packer then we Read variables for detected OS from /vars/var_<linux-os>.yml files
example
- name: read variables for ubuntu 20.04
include_vars: "vars_os_ubuntu-20.yml"
when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "20.04"
As you can see in the above code, we have specifically mentioned the Ubuntu version, now, if the version changes to 22.04 or let say 24.04, how can we set this value dynamically?
Is there any way where we can implement the same in Ansible?