I am in the process of experimenting with Chef and here's one of them
knife create cookbook host_file_update
Then create the recipe
recipes/default.rb
templates/default/hosts.erb
knife create cookbook host_file_update
Then create the recipe
recipes/default.rb
hosts = search(:node, "*:*")
template "/etc/hosts" do
source "hosts.erb"
owner "root"
group "root"
mode 0644
variables(
:hosts => hosts,
:hostname => node[:hostname],
:fqdn => node[:fqdn]
)
end
And then the template file hosts.erb referenced abovetemplates/default/hosts.erb
127.0.0.1 localhost <% @hosts.each do |node| %> <%= node['ipaddress'] %> <%= node['hostname'] %> <%= node['fqdn'] %> <% end %>
Pretty useful, if you want to populate this automatically as and when you add servers. One of the next things to try is see if we can make Chef pick the additional IPs (e.g service net in Rackspace cloud) and create separate entries for it
When seeking how to choose a web host to meet your needs, you must first know what these needs are. You should then carry out web hosting research to establish those services that are suitable. Here are the various aspects of a website that you should be aware of when researching web hosting options. https://onohosting.com/
ReplyDelete