Sha256: 7198cb5bfffd640185b4a4862f0ad079e11f87f76dc80f40189c9dc2f6a58fe1
Contents?: true
Size: 791 Bytes
Versions: 7
Compression:
Stored size: 791 Bytes
Contents
# encoding: UTF-8 # Copyright (c) 2018 António Meireles. All Rights Reserved. module VagrantPlugins module GuestClearLinux module Cap class ChangeHostName def self.change_host_name(machine, name) machine.communicate.tap do |comm| unless comm.test("hostnamectl --static | grep '#{name}'") comm.sudo([ "rm /etc/machine-id", "systemd-machine-id-setup", "hostnamectl set-hostname --static '#{name}'", "hostnamectl set-hostname --transient '#{name}'", "hostnamectl set-hostname --set-chassis vm", "systemctl restart systemd-networkd.service" ].join("\n")) end end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems