Using Salt to provision an appvm

36 views
Skip to first unread message

Elias Mårtenson

unread,
Feb 12, 2018, 2:17:48 AM2/12/18
to qubes-users
I'm trying to use Salt to set up my standard configuration, which includes a few appvms used for various purposes.

I have been able to create scripts that sets up the dom0 configuration, creates the VMs, and configures the templates.

But when I try to use the same mechanism to configure the appvms (specifically, updating /rw/config/rc.local, installing some default configuration in the user's home directory etc) that script simply doesn't seem to run.

I tried to create a minimal test case, and this is what I have done:

/srv/salt/custom/backup.top:
--------
backup:
^backup$:
-match: pcre
- custom.backup
--------

/src/salt/custom/backup.sls:
--------
create-test-file:
cmd.run:
- name: echo foo > /home/user/foo.txt
- runas: user
--------

I also have a rule that actually creates the "backup" vm.

After running this, nothing happens in the appvm, and the /var/log/qubes/mgmt-backup.log contains the following:

--------
calling 'state.highstate':
output: backup:
output: - No matching salt environment for environment 'backup' found.
output: - No matching sls found for 'custom.backup' in env 'backup'.
exit code: 0
--------

What have I done wrong here?

Regards,
Elias

viq

unread,
May 3, 2018, 8:46:24 AM5/3/18
to Elias Mårtenson, qubes-users
On 18-02-11 23:17:48, Elias Mårtenson wrote:
> I'm trying to use Salt to set up my standard configuration, which includes a few appvms used for various purposes.
>
> I have been able to create scripts that sets up the dom0 configuration, creates the VMs, and configures the templates.
>
> But when I try to use the same mechanism to configure the appvms (specifically, updating /rw/config/rc.local, installing some default configuration in the user's home directory etc) that script simply doesn't seem to run.
>
> I tried to create a minimal test case, and this is what I have done:
>
> /srv/salt/custom/backup.top:
> --------
> backup:

This needs to be just 'base', unless you really did configure 'backup' environment.
See eg https://docs.saltstack.com/en/latest/topics/tutorials/states_pt4.html

> ^backup$:
> -match: pcre

You missed a space after dash. And you can have just 'backup' and drop
the match, default matcher is glob.

> - custom.backup
> --------
>
> /src/salt/custom/backup.sls:
> --------
> create-test-file:
> cmd.run:
> - name: echo foo > /home/user/foo.txt
> - runas: user
> --------
>
> I also have a rule that actually creates the "backup" vm.
>
> After running this, nothing happens in the appvm, and the /var/log/qubes/mgmt-backup.log contains the following:
>
> --------
> calling 'state.highstate':
> output: backup:
> output: - No matching salt environment for environment 'backup' found.
> output: - No matching sls found for 'custom.backup' in env 'backup'.
> exit code: 0
> --------
>
> What have I done wrong here?
>
> Regards,
> Elias
>
> --
> 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 qubes-users...@googlegroups.com.
> To post to this group, send email to qubes...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/qubes-users/4f8b4c25-9c75-4466-aeef-68c238ee87f0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages