I'm trying to use Ansible to automate a variable in a configuration file. I have a template config file that contains this line "config_version={{osVersion}}" This playbook gets ran against RHEL 7 and 8 machines, ideally, I'd like ansible to get the version and major release of the hosts it is running the playbook on then populate that {{osVersion}} with each machine version.
I've tried finding about this specific use case and nothing seems to be coming up for me. On how to accomplish this.
to summarize the template contains this "config_version={{osVersion}}" I'd like to have that template be on the machine, check the machine for its version, then write the version to the config file for one or many hosts.