我有Hiera与木偶/流浪汉一起运行。
说我有一个木偶执行官做了以下
exec {create-project-database: command => ’mysql -u root -e“CREATE DATABASE …
你的报价有问题 'hiera('project_db)' (即你没有在括号前关闭 hiera('project_db') 应该是正确的)
'hiera('project_db)'
hiera('project_db')
通常我会在这之前从hiera声明变量
$DB_NAME = hiera('project_db') exec { create-project-database: command => "mysql -u root -e \"CREATE DATABASE $DB_NAME DEFAULT CHARACTER SET = 'utf8';\"", unless => 'mysql -u root information_schema -e "select * from information_schema.schemata;" | grep "project_db"', require => Package[mysql-server], }