2020-11-22 07:00:00 +00:00
|
|
|
package 'dnsmasq'
|
|
|
|
|
2019-03-03 08:50:49 +00:00
|
|
|
%w(dnsmasq resolvconf systemd-resolved).each do |s|
|
|
|
|
service s do
|
|
|
|
action :nothing
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
case run_command('grep VERSION_ID /etc/os-release | awk -F\" \'{print $2}\'').stdout.chomp
|
2024-06-10 02:41:24 +00:00
|
|
|
when "24.04"
|
2024-11-03 01:56:38 +00:00
|
|
|
execute "change link to /etc/resolv.conf" do
|
|
|
|
command "ln -fs /run/systemd/resolve/resolv.conf /etc/resolv.conf"
|
|
|
|
end
|
|
|
|
|
|
|
|
directory "/etc/systemd/resolved.conf.d/" do
|
|
|
|
mode "0755"
|
|
|
|
owner "root"
|
|
|
|
group "root"
|
|
|
|
end
|
|
|
|
|
|
|
|
template '/etc/systemd/resolved.conf.d/partial.conf' do
|
2024-06-10 02:41:24 +00:00
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
2024-11-03 01:56:38 +00:00
|
|
|
source 'templates/etc/systemd/resolved.conf.d/partial.conf.erb'
|
|
|
|
variables(dns: node['consul']['dns'])
|
2024-06-10 02:41:24 +00:00
|
|
|
|
|
|
|
notifies :restart, 'service[systemd-resolved]', :immediately
|
|
|
|
end
|
|
|
|
|
2024-11-03 01:56:38 +00:00
|
|
|
remote_file "/etc/default/dnsmasq" do
|
|
|
|
mode "0644"
|
|
|
|
owner "root"
|
|
|
|
group "root"
|
|
|
|
end
|
|
|
|
|
2024-06-10 02:41:24 +00:00
|
|
|
remote_file '/etc/dnsmasq.conf' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
|
|
|
notifies :restart, 'service[dnsmasq]', :immediately
|
|
|
|
end
|
|
|
|
|
2022-10-01 02:56:17 +00:00
|
|
|
when "22.04"
|
|
|
|
template '/etc/systemd/resolved.conf' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
2022-10-01 12:41:52 +00:00
|
|
|
source 'templates/etc/systemd/resolved.conf.2204.erb'
|
2022-10-01 02:56:17 +00:00
|
|
|
variables(dns: node['consul']['dns'])
|
|
|
|
|
|
|
|
notifies :restart, 'service[systemd-resolved]', :immediately
|
|
|
|
end
|
|
|
|
|
|
|
|
remote_file '/etc/dnsmasq.conf' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
2024-06-10 02:41:24 +00:00
|
|
|
source 'files/etc/dnsmasq.conf.2204'
|
|
|
|
|
2022-10-01 02:56:17 +00:00
|
|
|
notifies :restart, 'service[dnsmasq]', :immediately
|
|
|
|
end
|
|
|
|
|
|
|
|
when "20.04"
|
2020-10-10 07:17:19 +00:00
|
|
|
template '/etc/systemd/resolved.conf' do
|
2019-03-03 08:50:49 +00:00
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
2022-07-10 07:28:49 +00:00
|
|
|
variables(dns: node['consul']['dns'])
|
2019-03-03 08:50:49 +00:00
|
|
|
|
2020-10-10 07:17:19 +00:00
|
|
|
notifies :restart, 'service[systemd-resolved]', :immediately
|
2019-03-03 08:50:49 +00:00
|
|
|
end
|
2020-10-10 07:17:19 +00:00
|
|
|
|
2019-03-03 08:50:49 +00:00
|
|
|
remote_file '/etc/dnsmasq.conf' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
2020-10-10 07:17:19 +00:00
|
|
|
source 'files/etc/dnsmasq.conf.2004'
|
2019-03-03 08:50:49 +00:00
|
|
|
|
2020-10-10 07:17:19 +00:00
|
|
|
notifies :restart, 'service[dnsmasq]', :immediately
|
2019-03-03 08:50:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
when "18.04"
|
|
|
|
remote_file '/etc/systemd/resolved.conf' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
|
|
|
notifies :restart, 'service[systemd-resolved]'
|
|
|
|
end
|
2020-10-10 07:17:19 +00:00
|
|
|
|
|
|
|
remote_file '/etc/dnsmasq.conf' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
|
|
|
source 'files/etc/dnsmasq.conf.1804'
|
|
|
|
|
|
|
|
notifies :reload, 'service[dnsmasq]'
|
|
|
|
end
|
|
|
|
|
|
|
|
when '16.04'
|
2019-03-03 08:50:49 +00:00
|
|
|
remote_file '/etc/resolvconf/resolv.conf.d/head' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
|
|
|
notifies :restart, 'service[resolvconf]'
|
|
|
|
end
|
2020-10-10 07:17:19 +00:00
|
|
|
|
|
|
|
remote_file '/etc/dnsmasq.conf' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
|
|
|
source 'files/etc/dnsmasq.conf.1804'
|
|
|
|
|
|
|
|
notifies :reload, 'service[dnsmasq]'
|
|
|
|
end
|
2019-03-03 08:50:49 +00:00
|
|
|
end
|
2020-10-10 07:17:19 +00:00
|
|
|
|