diff --git a/recipes/default.rb b/recipes/default.rb index 35d9b1cf..7bb6ed91 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -153,11 +153,10 @@ group 'root' code <<-EOH set -e - cp /etc/resolv.conf /etc/resolv.conf.bak - rm -f /etc/resolv.conf - echo "nameserver #{my_ip}" > /etc/resolv.conf - chmod 644 /etc/resolv.conf - chattr +i /etc/resolv.conf + cp #{effective_resolv_conf} #{effective_resolv_conf}.bak + chattr -i #{effective_resolv_conf} + sed -i 's;^nameserver[[:space:]].*$;nameserver #{my_ip};g' #{effective_resolv_conf} + chattr +i #{effective_resolv_conf} EOH action :nothing end