0
votes

From a fresh salt stack installation on server and client, the goal is to serve a file with a number inside:

SERVER
$vim /etc/salt/master

...
file_roots:
  base:
    - /srv/salt
...

$echo 1 > /srv/salt/tmp/salt.config.version
$cat /srv/salt/top.sls

base:
  '*':
    - tmpversion

$cat /srv/salt/tmpversion/init.sls

/tmp/salt.config.version:
  file.managed:
    - source: salt://tmp/salt.config.version
    - user: root
    - group: root
    - mode: 644

CLIENT (minion)
$vim /etc/salt/minion

...
master: <masterhostnamehere>
...

I'm using salt '*' state.sls tmpversion to apply the configuration. I don't know how to get the changes applied automatically..

1
Can you provide the exact cli command you're using to apply this state and the output you're getting? - Utah_Dave
I'm using salt '*' state.sls tmpversion. It's working but does not persist. - martin
What duo you mean by, "It's working, but does not persist"? - Utah_Dave
When I run salt '*' state.sls tmpversion it works as expected creating the tmp file. But if I remove the tmp file it does not automatically reapply the state. I have to manually run the command again. Should I use crontab to ensure the command gets executed once in a while? - martin
yes, you should use cron or some other scheduler to achieve this. - Vasili Syrakis

1 Answers

1
votes

Salt doesn't do anything until you tell it to. So that means that you have to run the salt command on the cli when you want a state to be applied, or you can use Salt's internal scheduler or your system's cron to run the job regularly.