Reputation: 171
On salt modules how can I enable a custom service, provided a path to the service file.
custom_service:
service.enable:
- name: foo
- path:
Upvotes: 0
Views: 1392
Reputation: 7340
From your question, it appears that you already have the systemd foo.service
file on the miniom(s) at the appropriate location, and you would like to enable that service.
Not specific to Saltstack, but when service configuration files are updated, the daemon needs to be reloaded. That can be achieved as below in SLS:
reload-systemd:
module.run:
- name: service.systemctl_reload
custom-service:
service.enabled:
- name: foo
Note:
If the service configuration file isn't on the minion at the required path, then you can use module such as file.managed
to place it there.
Upvotes: 1