I would like to disable cron on the minion when salt gets executed.

Disabling it would be easy: service.disabled

But how to enable it again (in all cases (success or error))?

What I want is comparable with a context-manager in the python programming language.


All states are executed, even when some failed, if they do not require a failed one. So you could start with a service.dead, some other states, then a service.running at the end.

I don't understand why you would want that, though.

  • AFAIK failhard does brake this. If a failhard state fails, then no other states get executed. But I am unsure. Maybe I am wrong: docs.saltstack.com/en/latest/ref/states/… – guettli Sep 24 '18 at 11:22
  • Yes, that's the purpose of failhard, indeed. – Christophe Drevet-Droguet Sep 24 '18 at 15:10
  • I understand the need because we have the same with apticron when running integration tests. Sometimes, during tests, apticron run and this make highstate fail (because /var/cache/apt locked). So we configure apticron to never run when running tests. – daks Jan 17 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.