I want to define a global var (_cfg_chrony) based on Linux distributions:
If the OS family is Redhat, define the config path of /etc/chrony.conf
; if the OS family is Debian, define the config path of /etc/chrony/chrony.conf
I tried to do something like this at the beginning of my playbook but seems it only applies the last variable and ignores the conditions:
vars:
_cfg_chrony: /etc/chrony.conf
when: ansible_facts['os_family'] == "RedHat"
_cfg_chrony: /etc/chrony/chrony.conf
when: ansible_facts['os_family'] == "Debian"
How to setup this properly?