3ofcoins / chef-cookbook-hostname

Chef cookbook to set node's hostname and FQDN.
MIT License
41 stars 90 forks source link

Set hostname but NOT alias to loopback? #53

Closed Joseph-R closed 9 years ago

Joseph-R commented 9 years ago

So I'm in a curious situation. I want to set the hostname and FQDN to deploy an automated, single-node version of Hortonwork's Data Platform using Apache Ambari.

But HDFS itself [responds poorly|http://wiki.apache.org/hadoop/ConnectionRefused] to hostnames being configured to the loopback address.

So I'd like to configure where the host name and FQDN are set in code, but only aliased to an external IP in the /etc/hosts file. Is that possible? How can I best accomplish this?

Do the desired end-state I'm looking for would be something like these two files:

/etc/sysconfig/network:

[root@hdp vagrant]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=hdp.local

/etc/hosts:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1     localhost localhost.localdomain localhost6 localhost6.localdomain6

33.33.33.100    hdp.local hdp
Joseph-R commented 9 years ago

So the answer is "yes". I think.

Using node.default['hostname_cookbook']['hostsfile_ip'] = "#{node['ipaddress']}", I was able to set the internal IP to the FQDN and hostname.

I was not able to figure that out for a dynamically set external on both Vagrant and EC2. But it turned out I didn't have to. So I didn't.