This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
zhangzhihan-device-manageme…/roles/consul-cluster/templates/consul_bind_ip_generate.sh.j2
zhangzhihan 960bdaa91f create
2020-01-17 15:35:48 +08:00

7 lines
401 B
Django/Jinja
Executable File

#!/bin/bash
#BIND_ADDRESS=$(/usr/sbin/ip route | /usr/bin/grep default | head -n 1 | /usr/bin/awk '{print $5}' | /usr/bin/xargs ifconfig | /usr/bin/grep "inet" | /usr/bin/grep -v "inet6" | /usr/bin/awk '{print $2}')
BIND_ADDRESS=$(ifconfig {{ consul.cluster_nig_mgr }} | grep inet | head -1 |awk '{print $2}')
#BIND_ADDRESS=192.168.200.5
systemctl set-environment CONSUL_BIND_ADDRESS=${BIND_ADDRESS}