feat: add management of /etc/hosts

- add class to manage the /etc/hosts file
- add static hosts to /etc/hosts file via hiera array/hash
This commit is contained in:
2023-10-22 00:32:10 +11:00
parent aaee62afad
commit 95434214a9
4 changed files with 63 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
# /etc/hosts file managed by Puppet
# The following lines are desirable for IPv4 capable hosts
127.0.0.1 <%= @fqdn %> <%= @hostname %>
127.0.0.1 localhost.localdomain localhost
127.0.0.1 localhost4.localdomain4 localhost4
# The following lines are desirable for IPv6 capable hosts
::1 <%= @fqdn %> <%= @hostname %>
::1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
<% @additional_hosts.each do |host| -%>
<%= host['ip'] %> <%= host['hostname'] %> <%= host['aliases'].join(' ') if host['aliases'] %>
<% end -%>