aboutsummaryrefslogtreecommitdiff
path: root/templates/host.conf.erb
blob: c483d6295f96a002f6a72e7687e73b3cef0ba4e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<%- @hash_data.sort.each do |host, data|
  scope.function_validate_hash([data]) 
  raise Puppet::ParseError, "Missing interfaces hash for host '#{host}'" unless data.has_key? 'interfaces' 
  data.fetch('interfaces').sort.each do |if_name, if_mac|
    scope.function_validate_re([if_name, '^\S+$'])
    scope.function_validate_string([if_mac])
    scope.function_validate_re([if_mac, '^[A-Fa-f0-9:.]+$'])
 -%>
host <%= host %>-<%= if_name %> {
  hardware ethernet <%= if_mac %>;
<%
  fixed_address = data.fetch('fixed_address', nil) || host
  scope.function_validate_string([fixed_address])
  scope.function_validate_re([fixed_address, '^\S+$'])
 -%>
  fixed-address <%= fixed_address %>;
<%
  options = data.fetch('options', nil) || @global_options
  scope.function_validate_array([options])
  unless options.empty?
 -%>
  <%= options.join(";\n") %>;
<% end -%>
}
<% end -%>
<% end -%>