Setting node name in chef to hostname
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Expired
|
Wishlist
|
Unassigned |
Bug Description
We are using auto-install to PXE boot a number of ubuntu 20.04 hosts. These hosts are physical servers. The hostname is set via DHCP, however in the auto-install configuration file we set the identity to "localhost".
We are also trying to boot strap these servers with chef. For this we are using the user-data section in auto-install to invoke the chef module of cloud-init on first boot. This kinda works, but all the hosts which register with our chef server in this way report with a name of : iid-datasource-none
The only way we have found so far around this problem was to not accept the license in the chef module and to invoke a chef-client run via the run-cmd module as follows.
runcmd:
- knife ssl fetch -c /etc/chef/client.rb
- knife ssl check -c /etc/chef/client.rb
- chef-client -N `hostname -f` --chef-license accept
- rm /etc/chef/
This is not a very nice approach and it would be much better to have this option supported in the node_name attribute from the chef module or maybe add a separate flag to the module to use the systems hostname rather than the identity or the hostname (localhost) cloud-init thinks we are using.
Hopefully there is another way around this which I have missed so far.
Hmm this is partly a consequence of switching subiquity to using DataSourceNone to configure the installed system. I'm not sure it can be fixed without cloud-init changes unfortunately.