From 5b8e5b50ab0aa92c1f063a757ab75767dd0b9155 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 10 Aug 2019 18:53:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?`192.168.10.0/24`=E3=82=BB=E3=82=B0?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=88=E3=81=AE=E3=82=A2=E3=83=89=E3=83=AC?= =?UTF-8?q?=E3=82=B9=E3=82=92=E6=8C=87=E5=AE=9A=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cookbooks/consul/attributes.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbooks/consul/attributes.rb b/cookbooks/consul/attributes.rb index 2b259de..dd163ed 100644 --- a/cookbooks/consul/attributes.rb +++ b/cookbooks/consul/attributes.rb @@ -3,9 +3,9 @@ # ------------------------------------------- case run_command('grep VERSION_ID /etc/os-release | awk -F\" \'{print $2}\'').stdout.chomp when "18.04" - cmd = 'LANG=C /sbin/ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d" " -f10' + cmd = 'LANG=C /sbin/ifconfig | grep "inet " | grep 192.168 | cut -d" " -f10' else - cmd = 'LANG=C /sbin/ifconfig | grep "inet addr" | grep -v 127.0.0.1 | awk "{print $2;}" | cut -d: -f2 | cut -f 1 -d " " | tail -1' + cmd = 'LANG=C /sbin/ifconfig | grep "inet addr" | grep 192.168 | awk "{print $2;}" | cut -d: -f2 | cut -f 1 -d " " | tail -1' end ipaddr = run_command(cmd).stdout.chomp