Module: VagrantPlugins::DnsConf::Cap::Ubuntu::SetDnsConf

Defined in:
lib/vagrant-dnsconf/cap/ubuntu/set_dnsconf.rb

Class Method Summary collapse

Class Method Details

.set_dnsconf(m, opts) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/vagrant-dnsconf/cap/ubuntu/set_dnsconf.rb', line 9

def self.set_dnsconf(m, opts)
  #sed -i -e "s/4.2.2.1 4.2.2.2 208.67.220.220/192.168.16.10 192.168.16.11/" /etc/systemd/resolved.conf -e "s/DNSSEC=yes/DNSSEC=no/"
         file = "/etc/systemd/resolved.conf"
  opts[:deletes].each do |delete|
           m.communicate.sudo("sed -i -e \"s/#{delete}//\" #{file}")
  end
  opts[:replaces].each do |replace|
           m.communicate.sudo("sed -i -e \"s/#{replace[:before]}/#{replace[:after]}/\" #{file}")
  end

         m.communicate.sudo("sed -i -e \"s/DNSSEC=yes/DNSSEC=no/\" #{file}") unless opts[:dnssec]
         m.communicate.sudo("systemctl restart systemd-resolved")
end