From 6b53c30a774e6b7fc48010d31b67225abffeb6df Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 19 Jan 2025 22:13:55 +0900 Subject: [PATCH] Add a logic to customize `resolv.conf` for LXC containers. --- cookbooks/consul/dnsmasq.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbooks/consul/dnsmasq.rb b/cookbooks/consul/dnsmasq.rb index 710ef6b..3438604 100644 --- a/cookbooks/consul/dnsmasq.rb +++ b/cookbooks/consul/dnsmasq.rb @@ -8,8 +8,10 @@ end case run_command('grep VERSION_ID /etc/os-release | awk -F\" \'{print $2}\'').stdout.chomp when "24.04" - execute "change link to /etc/resolv.conf" do - command "ln -fs /run/systemd/resolve/resolv.conf /etc/resolv.conf" + unless node['base']['lxc'] + execute "change link to /etc/resolv.conf" do + command "ln -fs /run/systemd/resolve/resolv.conf /etc/resolv.conf" + end end directory "/etc/systemd/resolved.conf.d/" do