host資源簡介
host資源主要用來管理作業系統的hosts功能,hosts是一個沒有擴充名的系統檔案,基本作用就是将一些常用的域名與其對應的IP位址建立一個關聯的資料庫。
1、host資源常用屬性
host {'資源标題':
host_aliases
ensure
ip
name
qtarget
}
◆ host_aliases:主機能有任意别名。
◆ ensure:确定該主機是否啟用,present即啟用,absent即關閉。
◆ ip:主機的IP位址,支援IPV4和IPV6。
◆ name:主機名。
◆ target:指定自定義host檔案的位置。
給hosts添加一條解析,編輯/etc/puppet/manifests/hosts.pp
host {'test.comratings.com':
ensure => present,
ip => '10.0.0.10',
然後在主機上面應用一下檢視
# puppet apply hosts.pp
notice: /Stage[main]//Host[test.comratings.com]/ensure: created
notice: Finished catalog run in 0.02 seconds
檢視/etc/hosts,發現已經追加了我們所需要的解析。
本文轉自 wzlinux 51CTO部落格,原文連結:http://blog.51cto.com/wzlinux/1685616,如需轉載請自行聯系原作者