Skip to content

scottchoi/hosts_file

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Managed Hosts File

Manage your hosts file with chef.

Base configurables:

  • default[:hosts_file][:path] = '/etc/hosts'
  • default[:hosts_file][:define_self] = 'ip_address' # or 'loopback' or 'localhost_only'

Via Attributes

override_attributes(
  :hosts_file => {
    :custom_entries => {
      '192.168.0.100' => 'www.google.com',
      '192.168.0.101' => %w(www.yahoo.com www.altavista.com)
    }
  }
)

Via LWRP

hosts_file_entry '192.168.0.100' do
  hostname 'www.google.com'
  aliases %w(google.com gmail.com www.gmail.com)
  comment "Override some google lookups"
end

and ensure you add the default recipe to the run list:

run_list(["recipe[hosts_file]"])

Repo:

About

Manage hosts file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%