Manage hosts file
Ruby HTML
Latest commit 82f3e98 Jul 18, 2017 @tas50 tas50 Merge pull request #18 from yakara-ltd/develop
Allow public_ips attribute to be set to false to disable these entries
Permalink
Failed to load latest commit information.
attributes Allow public_ips attribute to be set to false to disable these entries Mar 28, 2017
providers Store into run-state instead of node data Jun 21, 2013
recipes Allow public_ips attribute to be set to false to disable these entries Mar 28, 2017
resources
templates/default Store into run-state instead of node data Jun 21, 2013
.gitignore add .gitignore Mar 25, 2016
.kitchen.yml Reverse order of FQDN and hostname for localhost Apr 12, 2016
CHANGELOG.md hosts_file 0.2.2 Mar 25, 2016
CODE_OF_CONDUCT.md Code of Conduct Mar 25, 2016
CONTRIBUTING.md Contributing information Mar 25, 2016
Cheffile add tooling for repository Mar 25, 2016
Gemfile need to include rake Mar 25, 2016
README.md Close up code block example Sep 4, 2012
Rakefile add tooling for repository Mar 25, 2016
metadata.rb hosts_file 0.2.2 Mar 25, 2016

README.md

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: