We use SaltStack for configuration management since some weeks.
How to handle the distribution specific location of systemctl
?
- On Ubuntu:
/bin/systemctl
- On SuSE:
/usr/bin/systemctl
At the moment I add two lines to the sudoers file:
etc_sudoers:
file.blockreplace:
- name: /etc/sudoers
- marker_start: "# START managed etc_sudoers -DO-NOT-EDIT-"
- marker_end: "# END managed zone etc_sudoers --"
- content: |
some_user ALL = NOPASSWD: /bin/systemctl restart apache2
some_user ALL = NOPASSWD: /usr/bin/systemctl restart apache2
{% endfor %}
- append_if_not_found: True
- backup: '.bak'
- show_changes: True
.... Is there no simpler solution?