-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: Set the hostname of the system at creation time. #569
Comments
Is it possible to leverage a .kitchen.yml attribute for this? ohai should set it in production, but I think you should also be able to supply the hostname via attribute in test kitchen so it's available during testing. |
Every kitchen.yml variation I've tried doesn't work (hostname:, vm_hostname:, under driver:, under suites:...). provisioner: verifier: platforms:
suites:
transport: |
In your suites: section you'd want to set an attribute value for "hostname: 'my.host.name" As shown in the documentation: https://docs.chef.io/workstation/config_yml_kitchen/
|
So, I've gone over this multiple different ways and included other chef experts without any luck making this work. In the end, there is nothing in the logs and no indicator on the system (that I can find) that even references the specified hostname. |
Hmm, that's true, it's probably a system attribute that would get over-written/ridden anyway. 🤔 This may not be feasible unless there's some way to "spoof" the system hostname. |
Another option and might be easier is to set "tags" on the system that define what the system is. I'm assuming you're using the Hostname to make some logic decisions based off of that. But you could also tag a system as a "web server" or "database server" or whatever you want. Your logic would read those tags vs the hostname to make the required decisions. You're effectively separating the actual hostname which is a system value and does require some rebooting to set (I'm not sure how you get around that) from the logic you want your code to perform. Ideally you want the underlying hardware to not really have an impact on what your logic is. i.e. you'd strive to not really care about what the systems hostname is, but what "type" of system is it and what actions do I need to perform to ensure it can serve that function. Once your load balancer is setup and the ec2 is getting the proper traffic on the proper ports, the logic should only be concerned with ensuring the services on those ports are functioning the way they should be. Also using AWS you can set EC2 tags, or you can set Chef Tags, either should work fine for this situation. I tend to prefer the Chef Tags as they can be setup in the CF Templates on build and your Chef code can just pull them to consume them. |
🗣️ Foreword
Thank for taking the time to fill this feature request fully. Without it we may not be able to , and the issue may be closed without resolution.
🙍 Problem Statement
There is no capability to set the hostname of the system at creation time (yml file). Many of our existing (dev/test/stage/prod) systems already have their hostname set and some recipes utilize that. But for kitchen we can't accurately test these recipes in AWS. We are utilizing the hostname resource which requires a reboot and breaks the rest of the recipe test. So, it takes kitchen 2 runs to test these recipes.
❔ Possible Solution
adding hostname: or vm_hostname: to the driver would resolve this issue.
Again, we are using hostname resoruce which requires a reboot. Unfortunately, we can't move back to using Vagrant for testing becuase one step is installing an AWS agent which validates that it is an AWS-hosted system and will fail if it is not.
➕ Additional context
So, without the hostname being set at creation time, we have to rely on the hostname resource and the subsequent reboot. We also can't go back to non-AWS hosting as one of the software installations require to be an AWS hosted system.
Thanks for looking at this!
The text was updated successfully, but these errors were encountered: