<%= form_for @discovery_rule, :url => (@discovery_rule.new_record? ? discovery_rules_path : discovery_rule_path(:id => @discovery_rule.id)) do |f| %> <%= base_errors_for @discovery_rule %> <%= text_f f, :name %> <%= autocomplete_f f, :search, :path => "discovered_hosts", :control_group_id => 'search_group', :size => 'col-md-9' %> <%= select_f f, :hostgroup_id, accessible_hostgroups, :id, :to_label, { :include_blank => false }, { :help_inline => _('Target host group for this rule with all properties set')} %> <%= text_f f, :hostname, :help_inline => popover( _("Template"), "
" + _("Specify target hostname template pattern in the same syntax as in Provisioning Templates (ERB).") + "
"+ "
" + _("Domain will be appended automatically. A hostname based on MAC address will be used when left blank. In addition to @host attribute function rand for random integers is available. Examples:") + "
"+ "
"+
    "myhost-<%= rand(99999) %>" + "\n\n" +
    "abc-<%= @host.facts['bios_vendor'] + " + "\n" +
    " '-' + rand(99999) %>" + "\n\n" +
    "xyz-<%= @host.hostgroup.name %>" + "\n\n" +
    "srv-<%= @host.discovery_rule.name %>" + "\n\n" +
    "server-<%= @host.ip.gsub('.','-') + " + "\n" +
    " '-' + @host.hostgroup.subnet.name %>" + "\n" +
    "
"+ ""+ "
"+ _("When creating hostname patterns, make sure the resulting host names are unique. Hostnames must not start with numbers. A good approach is to use unique information provided by facter (MAC address, BIOS or serial ID).") + "
", :title => _("Hostname for provisioned hosts")).html_safe %> <%= text_f f, :max_count, :label => _('Hosts limit'), :help_inline => _('Maximum hosts provisioned with this rule (0 = unlimited)') %> <%= text_f f, :priority, :help_inline => _('Rule priority (lower integer means higher priority)') %> <%= checkbox_f f, :enabled %> <%= submit_or_cancel f %> <% end %>