I try to configure a software, by sending a command to its running service. However, to apply the new configuration, the service needs to be restarted.
How can I do that?
I tried:
appsrv:
service.running:
- enable: True
configure_app:
cmd.run:
- name: configure_app_command
- unless: app_already_configured_command
- watch_in:
- service: appsrv
But it's not working, as the service is both required before and after the configuration. I also tried to use two different states: one for the service running, and one for the restart, but it was not better.
I guess I'll end up restarting the service "manually" in the configure_app
state, just after the configure_app_command
.
Any better way?