Hello!
Let’s say I have a simple dictionary in host_vars or group_vars:
host_presets: hostname: "{{ inventory_hostname.split('.')[0] }} domain: "{{ inventory_hostname| regex_replace('^' + inventory_hostname.split('.')[0] + '\\.', '')}}"
It works perfectly till I try to get it for other host with hostvars[‘myvm’].host_presets.hostname. In this case I get the hostname of the server that runs a playbook.
Is there a working way for dynamic predefining this kind of host/group vars?
Regards,
Roman