From: Tom Hughes Date: Thu, 16 Apr 2020 08:16:53 +0000 (+0100) Subject: Make configuration of hostname work properly X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/38242c2ddcec93702f548cc9f682a6db22880f6c?ds=sidebyside Make configuration of hostname work properly --- diff --git a/cookbooks/networking/attributes/default.rb b/cookbooks/networking/attributes/default.rb index a98942e4b..8d5cb035e 100644 --- a/cookbooks/networking/attributes/default.rb +++ b/cookbooks/networking/attributes/default.rb @@ -10,3 +10,4 @@ default[:networking][:interfaces] = {} default[:networking][:nameservers] = [] default[:networking][:search] = [] default[:networking][:dnssec] = "allow-downgrade" +default[:networking][:hostname] = node.name diff --git a/cookbooks/networking/recipes/default.rb b/cookbooks/networking/recipes/default.rb index 89e8198e2..321109a1d 100644 --- a/cookbooks/networking/recipes/default.rb +++ b/cookbooks/networking/recipes/default.rb @@ -177,18 +177,7 @@ package "cloud-init" do action :purge end -execute "hostname" do - action :nothing - command "/bin/hostname -F /etc/hostname" -end - -template "/etc/hostname" do - source "hostname.erb" - owner "root" - group "root" - mode 0o644 - notifies :run, "execute[hostname]" -end +hostname node[:networking][:hostname] template "/etc/hosts" do source "hosts.erb" diff --git a/cookbooks/networking/templates/default/hostname.erb b/cookbooks/networking/templates/default/hostname.erb deleted file mode 100644 index 9842667e9..000000000 --- a/cookbooks/networking/templates/default/hostname.erb +++ /dev/null @@ -1 +0,0 @@ -<%= node[:fqdn] %> diff --git a/roles/fume.rb b/roles/fume.rb index 176a22d61..44d665e30 100644 --- a/roles/fume.rb +++ b/roles/fume.rb @@ -6,6 +6,7 @@ default_attributes( :shm_size => "6g" }, :networking => { + :hostname => "seshat.civ.zcu.cz", :interfaces => { :external_ipv4 => { :interface => "ens3",