說明:
變量定義后可以直接調(diào)用變量名稱使用范例:
$etcd_controller1='10.100.84.22'$etcd_controller2='10.100.84.23'$etcd_controller3='10.100.84.24'$etcd_host1='gx-yun-084022.vclound.com'$etcd_host2='gx-yun-084023.vclound.com'$etcd_host3='gx-yun-084024.vclound.com'$etcd_connect="$etcd_host1=http://$etcd_host1:2380,$etcd_host2=http://$etcd_host2:2380,$etcd_host3=http://$etcd_host3:2380"$etcdcluster="$etcd_controller1:2379,$etcd_controller2:2379,$etcd_controller3:2379"說明:
可以利用 case , if 的方式進(jìn)行判斷, 效果一樣針對(duì)不同的主機(jī), 定義不同的變量使用范例
$myipaddress=$ipaddress_vlanbr0if $myipaddress =~ /^10/.201/.//*/ { $ntpserver = '10.201.100.21'} elsif $myipaddress =~ /^10/.200/.//*/ { $ntpserver = '10.200.100.21'} elsif $myipaddress =~ /^10/.205/.//*/ { $ntpserver = '10.205.100.25'} elsif $myipaddress =~ /^192/.168/.//*/ { $ntpserver = [ '10.199.129.21', '10.199.129.22' ]} elsif $myipaddress =~ /^10/.100/.//*/ { $ntpserver = [ '10.199.129.21', '10.199.129.22' ]}新聞熱點(diǎn)
疑難解答
圖片精選