lcreid / rails-5-jade

Rails 5 with Jekyll and Node on Ubuntu 18.04
MIT License
29 stars 3 forks source link

Make hostname and terminal prompt show something more informative #33

Open lcreid opened 5 years ago

lcreid commented 5 years ago

When running more than one box, it's hard to tell which box is which. It would be wonderful if the host name of the box could set itself to something interesting, like perhaps the directory name on the host where the box resides.

lcreid commented 5 years ago

Setting the host name to the directory was pretty easy. The problem is that it doesn't change the host name in /etc/hosts. I don't know how much of a problem that's going to be.

lcreid commented 5 years ago

P.S. The answer to changing the host name was to make a provisioner that ran:

hostnamectl set-hostname '#{File.basename(Dir.getwd)}'
lcreid commented 5 years ago

What's still missing is setting the host file. It looks like there's no "built-in" way to do this. I just have to script a sed command or something in the provider, to modify /etc/hosts.