2019-03-03 08:50:49 +00:00
|
|
|
# -------------------------------------------
|
|
|
|
# Specifying the default settings:
|
|
|
|
# -------------------------------------------
|
|
|
|
case run_command('grep VERSION_ID /etc/os-release | awk -F\" \'{print $2}\'').stdout.chomp
|
2022-07-10 05:29:24 +00:00
|
|
|
when "20.04", "22.04"
|
2020-10-10 07:17:19 +00:00
|
|
|
cmd = 'LANG=C ip a | grep "inet " | grep -v -E "(127|172)" | cut -d" " -f6 | perl -pe "s/\/.+//g"'
|
|
|
|
|
2019-03-03 08:50:49 +00:00
|
|
|
when "18.04"
|
2019-10-26 15:07:11 +00:00
|
|
|
cmd = 'LANG=C /sbin/ifconfig | grep "inet " | grep -v -E "(127|172)" | cut -d" " -f10'
|
2020-10-10 07:17:19 +00:00
|
|
|
|
2019-03-03 08:50:49 +00:00
|
|
|
else
|
2019-10-26 15:07:11 +00:00
|
|
|
cmd = 'LANG=C /sbin/ifconfig | grep "inet addr" | grep -v -E "(127|172)" | awk "{print $2;}" | cut -d: -f2 | cut -f 1 -d " " | tail -1'
|
2019-03-03 08:50:49 +00:00
|
|
|
end
|
|
|
|
ipaddr = run_command(cmd).stdout.chomp
|
|
|
|
|
2022-10-01 02:56:17 +00:00
|
|
|
cmd = 'grep nameserver /run/systemd/resolve/resolv.conf | grep -v 8.8.8.8 | grep -v 127.0.0.1 | perl -pe "s/nameserver //g" | sort | uniq | perl -pe "s/\n/ /g"'
|
2020-10-10 07:17:19 +00:00
|
|
|
dns = run_command(cmd).stdout.chomp
|
|
|
|
|
2019-03-03 08:50:49 +00:00
|
|
|
node.reverse_merge!({
|
|
|
|
'consul' => {
|
2020-11-22 08:25:09 +00:00
|
|
|
'manager' => false,
|
2022-07-10 05:31:18 +00:00
|
|
|
'manager_hosts' => '"192.168.10.101", "192.168.10.251", "192.168.10.252", "192.168.10.253"',
|
2020-10-10 07:17:19 +00:00
|
|
|
'ipaddr' => ipaddr,
|
2022-07-10 05:31:18 +00:00
|
|
|
'dns' => dns,
|
|
|
|
'encrypt' => 's2T3XUTb9MjHYOw8I820O5YkN2G6eJrjLjJRTnEAKoM=',
|
2023-12-09 07:56:05 +00:00
|
|
|
'token' => '39f8fc02-7ec7-ec7b-7bc6-e6e16bb8deca'
|
2019-03-03 08:50:49 +00:00
|
|
|
}
|
|
|
|
})
|