我剛剛開始使用puppet,並且在課堂中使用變量時有一個基本問題。這是我的課文件路徑必須完全合格 - 木偶
# == Class: mysql::configure_mysql
class mysql::configure_mysql inherits mysql {
$mysql_backup = "/var/mysql_backup"
#Create directories
file { 'mysql_backup':
path => '($mysql_backup)',
ensure => 'directory',
}
}
我得到一個錯誤
Error: Failed to apply catalog: Parameter path failed on File[mysql_backup]: File paths must be fully qualified, not '($mysql_backup)'
是否有人可以幫助我如何聲明一個變量,並使用它呢?
我已經使用這個供參考:https://serverfault.com/questions/41577/how-to-fix-puppet-fully-qualified-parameter-path-error
感謝
我確實嘗試了你的語法,它的確幫助了謝謝! – Adithya
也可以請指導我在哪裏可以存儲全局變量,以及如何跨越不同模塊使用它們?我真的很感激。 – Adithya
@Adithya Puppet可以使用的全局變量可以從Facter(由系統定義的字面全局變量)或數據(現在是Hiera,後來的Puppet數據提供程序;這些將由您定義)訪問。請查看以下鏈接:https://docs.puppet.com/facter/ https://docs.puppet.com/hiera/。 –