How do I clear a directory on a salt-minion using a state file? I want to delete all *.conf
files in /etc/supervisord/conf.d/
before I set up other supervisor services.
The following top.sls
configuration has no effect:
/etc/supervisor/conf.d/*:
file.absent
file.remove
fails as being unavailable.
Had same issue as you. That's what worked for me.
Not a perfect answer, but you could use file.absent on the directory, then recreate it. Note that this will delete the dir every time the state is run. You could get fancy with a jinja conditional surrounding the following:
You can use the cmd module in salt states. The following code could be present in your state file:
You can also write more complicated commands if you wish.