On Sun, Sep 13, 2020 at 10:31:31AM +0100, [email protected] wrote:
> > >
> >
> > Have you enabled the pillar in /srv/salt/user_pillar/top.sls?
> >
> > Example:
> >
> > In /srv/salt/user_pillar/top.sls I have a stanza:
> > user:
> > 'target':
> > - get
> >
> > In /srv/salt/user_pillar/get.sls, I set the pillar:
> > host: www.qubes-os.org
> >
> > Then I have the state and top files, get.sls and get.top:
> > get file:
> > cmd.run:
> > - name: wget {{pillar['host'] }}
> >
> > base:
> > target:
> > - get
> >
> >
> > qubesctl --skip-dom0 --targets=target state.apply get
> >
>
> First of all I'd like to thank you for your answer unman.
>
> I've tried your example (and after modifying it to be able to run it) I get
> exact the same error as before.
>
> Here's the setup:
>
> > Have you enabled the pillar in /srv/salt/user_pillar/top.sls?
> As far as I know, I have only to enable state.top files. But I have a file
> like you suggest located in /srv/salt/user_pillar/:
>
> > In /srv/salt/user_pillar/top.sls I have a stanza:
> > user:
> > 'target':
> > - get
>
> Ok!
>
> > In /srv/salt/user_pillar/get.sls, I set the pillar:
> > host: www.qubes-os.org
>
> Ok!
>
> > /srv/salt/user_salt/get.sls
> > get file:
> > cmd.run:
> > - name: wget {{pillar['host'] }}
>
> Ok!
>
> > /srv/salt/user_salt/get.top
> > base:
> > target:
> > - user_salt.get
>
> This one I had to modify as the get.sls is located in "/srv/salt/user_salt/".
> Above is already the modified version (user_salt is prefixed). I also enabled
> this top file by executing:
> sudo qubesctl top.enable user_salt.get
>
> Now, let's run this:
>
> > qubesctl --skip-dom0 --targets=target state.apply get
>
> When I'm executing this, I get the error logged in
> /var/log/qubes/mgmt-target.log:
> calling 'state.apply'...
> 2020-09-13 10:08:14,729 output: target:
> 2020-09-13 10:08:14,730 output: - Rendering SLS 'base:user_salt.get'
> failed: Jinja variable 'salt.utils.context.NamespacedDictWrapper object' has
> no attribute 'host'
>
> When I'm executing this (additional parameter
> --pillar-root=/srv/salt/user_pillar/):
> sudo qubesctl --skip-dom0 --targets=target state.apply
> --pillar-root=/srv/salt/user_pillar/
>
> The result is the same as I described before:
> target: ERROR (exception list index out of range)
>
> I also tried to modify the pillar top file to meet the different location:
> > In /srv/salt/user_pillar/top.sls I have a stanza:
> > user:
> > 'target':
> > - user_pillar.get
>
> But this haven't changed the results.
>
OK, it might have been better if you had NOT modified my example, as you
should then have been able to verify that user pillars can be referenced
in this way.
I always find it better to take one small step at a time when
troubleshooting or trying to learn something new.
In the new case, you are using the user environment. I would try the
following:
/srv/salt/user_salt/get.top
user:
target:
- get
/srv/salt/user_salt/get.sls
get file:
cmd.run:
- name: wget {{pillar['host'] }}
qubesctl --skip-dom0 --targets=target state.apply saltenv=user get
You might like to look at:
https://docs.saltstack.com/en/latest/ref/states/top.html#environments
New environments can be defined in
`/etc/salt/minions.d/f_defaults.conf`, but I rarely do this in Qubes.
--
You received this message because you are subscribed to the Google Groups
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/qubes-users/20200913141831.GA25257%40thirdeyesecurity.org.