[qubes-users] Using Qubes base Salt pillar in user_salt?

Hi,

When using the Salt user configuration located in '/srv/user_salt' what is the best way to use the Qubes specific pillars located (for this example) in '/srv/salt/_pillar'?

Step to reproduce my test:

- Install qubes.user-dirs

`qubesctl state.apply qubes.user-dirs`

- Enable custom-qubes.top

`qubesctl top.enable custom-qubes`

- File contents

/srv/user_salt/custom-qubes.top:

user:
   qubes:type:template:
     - match: pillar
     - template-prefs

/srv/user_salt/template-prefs.sls:

# -*- coding: utf-8 -*-
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :

template-vm-preferences:
   qvm.prefs:
     - include_in_backups: False
     - label: black
     - maxmem: 1000
     - netvm: sys-firewall
     - vcpus: 1

I get the following obvious error:

fedora-32:

The below script should give you the idea how to do it:

#!/bin/bash

Hi David,

David Hobach:

When using the Salt user configuration located in '/srv/user_salt' what is the best way to use the Qubes specific pillars located (for this example) in '/srv/salt/_pillar'?

The below script should give you the idea how to do it:

[..]

Thank you very much for sharing this script.

I would prefer very much to do it in a Salt way rather than symlinking directories. It seems that this is possible in Saltstack and it's mentioned in the Management stack documentation of Qubes here:
  https://www.qubes-os.org/doc/salt/#top-files

"For each target you can write a list of state files. Each line is a path to a state file (without the .sls extension) relative to the main directory. Each / is exchanged with a ., so you can’t reference files or directories with a . in their name."

Any directions on how can I include the base PATH of the pillars '/srv/salt' to the top or sls file?

/srv/user_salt/custom-qubes.top:

user:
   qubes:type:template:
     - match: pillar
     - .template-prefs

Cheers,
~Vasilis