'Salt enabling systemctl service using a custom service file
On salt modules how can I enable a custom service, provided a path to the service file.
custom_service:
service.enable:
- name: foo
- path:
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | seshadri_c |
