← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1912437] [NEW] Setting node name in chef to hostname

 

Public bug reported:

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/validation.pem      

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.

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1912437

Title:
  Setting node name in chef to hostname

Status in cloud-init:
  New

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/validation.pem      

  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1912437/+subscriptions


Follow ups