Skip to content
This repository has been archived by the owner on Sep 13, 2019. It is now read-only.

Remove node_name requirement from chef_lifecycle script #1

Open
webframp opened this issue Nov 22, 2016 · 3 comments
Open

Remove node_name requirement from chef_lifecycle script #1

webframp opened this issue Nov 22, 2016 · 3 comments

Comments

@webframp
Copy link

Just commenting in case this is something being considered for refactor. The chef_lifecycle script in this repo is currently just a static file and greps for node_name in the client.rb to determine instance name.

Currently it is recommended to leave node_name out of the chef client.rb, see node_name setting here and let chef determine it automatically from ohai data. So node_name seems like sort of an odd thing to depend on here: https://github.com/JonathanSerafini/chef-cfn/blob/master/files/default/chef_lifecycle#L15

Maybe this could be moved to a template that is rendered with the node name via ohai data or be converted to just use the ohai data directly.

Thanks for providing this cookbook.

@JonathanSerafini
Copy link
Owner

Holy hell someone actually uses this, awesome !

Aight, so far I've been using user-data to craft a custom client.rb with the node_name set, the rationale being that names are based on a mix of instance tags + instance id and that the node_name would therefore never vary.

I'll need to test how our nodes behave to having the hostname changed in user-data, but I don't foresee any issues so far and will look into getting this changed for you. Alternately, it may even be possible to do something with firstrun.json.

For the refactor, I was planning on:

  • general code cleanup
  • ohai module cleanup
  • further cloud-init improvements
  • documentation refactor
  • lwrp refactor to custom resource

@webframp
Copy link
Author

Awesome, will watch for the changes!

This cookbook is very useful to pull cfn data into ohai attributes, among other things. Thanks again.

@sandervanburken
Copy link

As an example, I solved it like this:

instance=$(ohai fqdn | jq -r '.[]')
knife node delete $instance --config-option node_name=$instance -c /etc/chef/client.rb -y

Thank you for all your efforts!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants