# Hiera role inheritance

I've got three roles defined in my control repo: desktop_common, desktop_office, and desktop_developer. I'm using hiera to set a variable systemd_default_target, which is multi-user in my common.yaml, but I'd like it to be graphical for all the roles above. (There are other roles which run headless, so it makes sense for the default to be multi-user.)

if I set a parameter in Foreman (my ENC) on each host group, called role, to specify which role to apply, and include roles::desktop_common in both of the others, most things are working fine, but it looks as though I now have to have the following in my hiera data:

common.yaml contains systemd_default_target: multi-user

roles/desktop_common.yaml contains systemd_default_target: graphical

roles/desktop_developer.yaml contains systemd_default_target: graphical

roles/desktop_office.yaml contains systemd_default_target: graphical

Is there a way to reduce this duplication, either by using some feature of hiera or by designing my roles better?

edit retag close merge delete