I struggled to be able to maintain my own /etc/hosts entries on OpenMediaVault.
For various reasons, this file is “controlled” by OMV, but there is no menu in the interface to customize its entries…
Moreover, there is no notion of “section” within the /etc/hosts file, where we could imagine OMV to be in full control of one, versus another section where we could maintain manually our entries…
So, I found this solution (after a while of browsing through Internet forums):
1. Create your own file (/etc/hosts2)
2. Create a SLS file that is used during /etc/hosts reconstruction
This file should be like this:
Filename : /srv/salt/omv/deploy/hosts/20myentries.sls
Content:
{% set hosts = salt['cmd.shell']('cat /etc/hosts2') %} append_custom_hosts: file.append: - name: "/etc/hosts" - text: "{{ hosts }}"
Expected outcome : each time the /etc/hosts is re-constructed by OMV, your specific file (/etc/hosts2) is appended to it…