I create a user foo
on a minion. The minion evalutes /etc/default/useradd
. This means the salt master does not know whether the new $HOME will be /home/foo
or in our case /localhome/foo
.
How can I get the $HOME of user foo
as jinia variable?
I need it in a systemd service file.
I would like to avoid custom pillar data, since this is redundant. Is there a way to get it via grains?
Does it work during boostrapping? First the user foo
needs to be created, then the systemd file can be created by looking up the $HOME of foo
...
This would work if the user does already exist:
{{ salt['user.info'](user).get('home') }}/foo:
file.recurse:
- source: salt://conf/common/foo
Related issue: https://github.com/saltstack/salt/issues/7883