Sha256: 214155dee2db764a0a160083e224f7f3cfd74430348b08575eb038e93c6bb314
Contents?: true
Size: 719 Bytes
Versions: 2
Compression:
Stored size: 719 Bytes
Contents
module VagrantPlugins module GuestDebian module Cap class ChangeHostName def self.change_host_name(machine, name) machine.communicate.tap do |comm| if !comm.test("hostname --fqdn | grep '^#{name}$' || hostname --short | grep '^#{name}$'") comm.sudo("sed -r -i 's/^(127[.]0[.]1[.]1[[:space:]]+).*$/\\1#{name} #{name.split('.')[0]}/' /etc/hosts") comm.sudo("sed -i 's/.*$/#{name.split('.')[0]}/' /etc/hostname") comm.sudo("hostname -F /etc/hostname") comm.sudo("hostname --fqdn > /etc/mailname") comm.sudo("ifdown -a; ifup -a; ifup eth0") end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tnargav-1.3.6 | plugins/guests/debian/cap/change_host_name.rb |
tnargav-1.3.3 | plugins/guests/debian/cap/change_host_name.rb |