salt - dependencies in scripts

58 views
Skip to first unread message

lik...@gmx.de

unread,
May 22, 2020, 7:19:10 PM5/22/20
to qubes...@googlegroups.com
Hi!

As salt is the recommended way to manage the Appms and templates, I'm trying to do so.

I successfully managed to create a top-script:

base:
dom0:
- match: nodegroup
- create-template
- create-appvm-for-template

'created-template':
- install-pkgs
- modify_config
- require: dom0

Unfortunately, the script fails on the first run, because step 2. requires step 1. done. "Require" seems not to work here. After the second run, everything is fine.

Any hints highly appreciated. :)

Best, P

unman

unread,
May 23, 2020, 9:10:00 AM5/23/20
to qubes...@googlegroups.com
A top file is used for *targeting* - it maps hosts/groups and
configurations/states that should apply.
`Requires` is a condition between states, so should be used in *state*
files. (I didn't even know it could be used in a top file)

Put the require statement in one of your state files. (Look how it's
treated in the whonix state files.)

unman

lik...@gmx.de

unread,
May 23, 2020, 6:33:43 PM5/23/20
to qubes...@googlegroups.com
On 2020-05-23 14:09, unman wrote:
1. Ok, what's your suggestion to create templates and AppVMs both of them? Should I run multiple runs with targeting several top files? I thought the best point of salt is to run just 1 command to setup the whole environment?

2. I tried to find the whonix state files, but I find only some python files in /srv/salt/_grains/whonix.*

unman

unread,
May 25, 2020, 8:20:59 PM5/25/20
to qubes...@googlegroups.com
I do two runs to provision a new system - one targetting dom0 to create
new templates/qubes and set prefs etc; the second with --skip-dom0 to
install software and configure individual qubes

>
> 2. I tried to find the whonix state files, but I find only some python files in /srv/salt/_grains/whonix.*

Look in /srv/formulas/base/virtual-machine-formula/qvm/ - examples of
configuration and use of templating.

Manuel Amador (Rudd-O)

unread,
May 28, 2020, 10:23:52 AM5/28/20
to qubes...@googlegroups.com
You can't use a `require` statement in the top file.  They only work in SLS files.
Reply all
Reply to author
Forward
0 new messages