Use facter

This commit is contained in:
Micke Nordin 2023-04-05 12:26:11 +02:00
parent e220a1b1c6
commit 4948ada609
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257

View file

@ -5,7 +5,7 @@ redis_password="<%= @redis_password %>"
for index in 1 2 3; do for index in 1 2 3; do
cur_host="redis${index}.$(hostname -d)" cur_host="redis${index}.$(hostname -d)"
if [[ "${my_host}" == "${cur_host}" ]]; then if [[ "${my_host}" == "${cur_host}" ]]; then
ip="$(hostname -I | awk '{print $1}')" ip="$(facter networking.ip)"
else else
ip="$(host "${cur_host}" | grep "has address" | awk '{print $NF}')" ip="$(host "${cur_host}" | grep "has address" | awk '{print $NF}')"
fi fi