cookbook 'set-hostname', '~> 1.2.1'
set-hostname (4) Versions 1.2.1 Follow1
Sets the hostname on a node and updates the hosts file.
cookbook 'set-hostname', '~> 1.2.1', :supermarket
knife supermarket install set-hostname
knife supermarket download set-hostname
Set Hostname
This simple cookbook sets the hostname on a given host using the node.name
as the default name, and appending any domain, if provided, for the fully qualified domain name of the host.
It also populates the file /etc/hosts
and /etc/hostname
files.
NOTE: this cookbook works well with DnsMadeEasy cookbook, that can automatically register the new hostname with DnsMadeEasy.com.
Attributes
You can set the following attributes:
node.normal['set-hostname']['domain'] = 'bar.com'
The following attributes are inferred automaticaly, but can also be overridden by the user:
default['set-hostname']['hosts-file'] = '/etc/hosts' default['set-hostname']['name'] = node.name default['set-hostname']['ip'] = node['ipaddress']
For a node with the name foo001
, the above configuration will result in the hostname set to foo.bar.com
and the IP address in the /etc/hosts
file will be 1.2.3.4
.
Default Attributes
The cookbook only requires that you set the domain portion of the name.
In that case, the actual hostname portion is inferred from the node.name
, and the IP address is taken from node['ipaddress']
unless provided specifically by the node['set-hostname']['ip]
attribute.
If you do not provide the domain name, the host is configured without the FQDN.
Automatic Reboot
If the hostname was changed, the cookbook will trigger a delayed reboot, but only if this attribute is set to true:
default['set-hostname']['allow-reboot-if-changed'] = true
The default is false.
Contributing
To contribute, please fork the cookbook and submit a pull request.
License
MIT License, full text is in the [LICENSE.md](LICENSE.md) file.
Authors
- Konstantin Gredeskoul (current maintainer)
- Eric Saxby
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
1.2.1 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
1.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.2.1 passed this metric
No Binaries Metric
1.2.1 passed this metric
Testing File Metric
1.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.2.1 failed this metric
1.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.2.1 passed this metric
No Binaries Metric
1.2.1 passed this metric
Testing File Metric
1.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.2.1 passed this metric
1.2.1 passed this metric
Testing File Metric
1.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.2.1 failed this metric
1.2.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number