Can i use variables as values to variables defined in inventory file

I am trying to imply environment wide values via inventory file for which i need to use some other variables as values.
My host file looks like this:

[linunx]
linux1
linux2

[windows]
windows1
windows2

[all]
linux
windows

[all:vars]
environment=ABC
client=XYZ
path=/opt/config/{{environment}}_{{client}}

Is this possible within inventory file or i will have to prepare all.yaml in group vars ?

Why not test it yourself?

In a folder create these 3 files, ansible.cfg, hosts and test.yml:

ansible.cfg
[defaults]
hostfile = hosts

hosts
[all:vars]
environment=ABC
client=XYZ
path=/opt/config/{{environment}}_{{client}}

test.yml

This seems to be working just fine. Ansible is parsing the variables in inventory files.