Hi,
i am trying to automate my setup but i am having a really bad time with saltstack.
First of all: I am new to salt. I took a look at the examples and read through parts of the original documentary.
I tried around a bit, just to get an echo from an new qube, pretty much like the example. This wont work, as the targeting fails.
test.top
base:
dom0:
- createecho
testqube:
- echostuff
createecho.sls
is working, as it creates the qube, it is basically identical to the example.
echostuff.sls
doecho:
cmd.run:
- name: echo "hello world"
I can enable it like described in the example, but when running it, only the dom0 part is executed. The part in testqube does not show up anywhere or is counted as a failed state. No error messages either.
After hours of trying different things, i found this workaround:
qubesctl --all --show-output state.highstate
does the trick, tho it goes through all existent qubes one by one, trying to match, taking around 1-2 second per qube to recognize, that it does not need to use it. Usually i have many qubes. This might be acceptable for initial setup but certainly not for other tasks What am i doing wrong?
I was a bit discouraged for me to take 5 hours to get to a “hello world”…
With the workaround i thought i should try something productive:
Here is what i want to do, and what parts fail. Hopefully somebody can help, or hint me in the right direction.
My usual template is a debian with zsh, oh-my-zsh and some other stuff. This means: I have to install zsh in the template, and oh-my-zsh in the appvm (it lives in the home directory).
I try to achieve the initial setup of the template and one appvm in salt:
- Copy debian template
- Install dependencies like zsh and python in the template
- Create AppVM
- Install oh-my-zsh in the AppVM
my .top
file looks like this:
base:
dom0:
- createtemplate
debian-11-custom:
- installtemplate
dom0:
- createappvm
testvm:
- installappvm
This errors with:
conflicting ID 'dom0'
So my question is: Is there any way to select the same target multiple times in a top file? There are numerous use cases for me, where i want to create a qube, do stuff in it and delete it afterwards. Is this not (easily) possible in saltstack?
Another thing:
What i recognized is, that salt does not give feedback until all states of one sls have been executed. Is there a better solution then to create one sls per command, as i really would like to see what is going on.
Honestly: I don’t know why i am torturing myself with this anyway. Where is the benefit of saltstack instead of using some scripts? (Serious question)
I hope maybe somebody can help me with that, as i feel truly lost.