In general, we do too many calls to ```NodeObject.find_node_by_name``` in this function. So I suggest this rewrite:
```
    tnodes = role.override_attributes["dns"]["elements"]["dns-server"]
    nodes = tnodes.map {|n| NodeObject.find_node_by_name n}

    # electing master dns-server
    master = nil
    admin = nil
    nodes.each do |node|
      if node[:dns][:master]
        master = node
        break
      else if node.admin?
        admin = node
      end
    end
    if master.nil?
      unless admin.nil?
        master = admin
      else
        master = nodes.first
      end
    end

    slave_ips = nodes.map {|n| n[:crowbar][:network][:admin][:address]}
    slave_ips.delete(master[:crowbar][:network][:admin][:address])

    nodes.each do |node|
      node[:dns][:master_ip] = master[:crowbar][:network][:admin][:address]
      node[:dns][:slave_ips] = slave_ips
      node[:dns][:slave_names] = slave_nodes
      node[:dns][:master] = (master.name == node.name)
      node.save
    end
```