我們擁有多個子接口和自己的子接口IP上運行多個應用程序,所以我試圖用facter
變量重複使用$name
木偶合並兩個變量定義
這裏是我在facter命令界面我的循環輸出
ipaddress_eth0_0 => 10.3.68.98
ipaddress_eth0_1 => 10.3.68.99
ipaddress_eth0_2 => 10.3.68.100
ipaddress_eth0_3 => 10.3.68.101
我艙單文件
define myapp {
exec {"$name":
command => /bin/sed -i 's/IP_ADDRESS=\"127.0.0.1\"/IP_ADDRESS=\"$ipaddress_eth0_$name\"/' /opt/app.$name/bin/setenv.sh
}
myapp { [ "0", "1" , "2", "3" ]: }
一些$ipaddress_eth0_$name
怎麼不工作:(其n解析這個變量,我如何加入兩個變量?
令人敬畏的人! – Satish
有關更多信息inline_template https://blog.kumina.nl/tag/inline_template/ – Satish