Repository navigation
root-ubuntu: ask for the hostname; /etc/hosts + cloud-init keep it - #146
Merged
Merged
Conversation
… across reboots
A stock image names the box after the image ("ubuntu", "user") and every
prompt repeats it. An interactive run now asks for the full DNS name
(BOX_HOSTNAME for unattended runs), sets it with hostnamectl, maps it and the
short name to 127.0.1.1, tells cloud-init to preserve it, and lets an unchosen
TS_HOSTNAME follow. Also drops a personal name from a comment, which the
script's own privacy test was failing on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThreatCrush Security Scan32 finding(s) HIGH/CRITICAL: 7 | MEDIUM: 12 | LOW: 13
Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hostname for this box, its full DNS name (e.g. box1.example.com) [current]:. Unattended runs only rename the box whenBOX_HOSTNAMEis set.hostnamectland writes one127.0.1.1 <fqdn> <short>line in/etc/hosts, so sudo doesn't print "unable to resolve host"./etc/cloud/cloud.cfg.d/99-preserve-hostname.cfgso cloud-init doesn't reset the name at boot.TS_HOSTNAMEnobody set explicitly follows the new short name.Tested:
bash -n;test/root-ubuntu.test.ts184/184 (was 183/184 on master); a stubbed run ofset_box_hostnamecovering rename, a no-op rerun, and an invalid name.🤖 Generated with Claude Code